aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-array-notation.c
diff options
context:
space:
mode:
authorBalaji V. Iyer <balaji.v.iyer@intel.com>2013-08-20 01:10:56 +0000
committerBalaji V. Iyer <bviyer@gcc.gnu.org>2013-08-19 18:10:56 -0700
commit318cda8521f7c4a390d42c3cd0cbba427a01eda7 (patch)
tree313e7fa61465ceac80856ae997ce3ae03f2e5254 /gcc/c/c-array-notation.c
parente42c64cb6dca35a4979db08706033d89b94f196f (diff)
downloadgcc-318cda8521f7c4a390d42c3cd0cbba427a01eda7.zip
gcc-318cda8521f7c4a390d42c3cd0cbba427a01eda7.tar.gz
gcc-318cda8521f7c4a390d42c3cd0cbba427a01eda7.tar.bz2
re PR c/57490 (ICE on c-c++-common/cilk-plus/AN/an-if.c)
Fix for PR c/57490. gcc/c/ChangeLog +2013-08-19 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR c/57490 + * c-array-notation.c (fix_conditional_array_notations_1): Added a + check for truth values. + (expand_array_notation_exprs): Added truth values case. Removed an + unwanted else. Added for-loop to walk through subtrees in default + case. + gcc/cp/ChangeLog +2013-08-19 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR c/57490 + * cp-array-notation.c (cp_expand_cond_array_notations): Added a + check for truth values. + (expand_array_notation_exprs): Added truth values case. Removed an + unwanted else. Added for-loop to walk through subtrees in default + case. + * call.c (build_cxx_call): Inherited the type of the array notation for + certain built-in array notation functions. + gcc/testsuite/ChangeLog +2013-08-19 Balaji V. Iyer <balaji.v.iyer@intel.com> + + PR c/57490 + * c-c++-common/cilk-plus/AN/pr57490.c: New test. + From-SVN: r201867
Diffstat (limited to 'gcc/c/c-array-notation.c')
-rw-r--r--gcc/c/c-array-notation.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/c/c-array-notation.c b/gcc/c/c-array-notation.c
index 7788f7b..5747bcb 100644
--- a/gcc/c/c-array-notation.c
+++ b/gcc/c/c-array-notation.c
@@ -906,6 +906,8 @@ fix_conditional_array_notations_1 (tree stmt)
cond = COND_EXPR_COND (stmt);
else if (TREE_CODE (stmt) == SWITCH_EXPR)
cond = SWITCH_COND (stmt);
+ else if (truth_value_p (TREE_CODE (stmt)))
+ cond = TREE_OPERAND (stmt, 0);
else
/* Otherwise dont even touch the statement. */
return stmt;
@@ -1232,6 +1234,12 @@ expand_array_notation_exprs (tree t)
case BIND_EXPR:
t = expand_array_notation_exprs (BIND_EXPR_BODY (t));
return t;
+ case TRUTH_ORIF_EXPR:
+ case TRUTH_ANDIF_EXPR:
+ case TRUTH_OR_EXPR:
+ case TRUTH_AND_EXPR:
+ case TRUTH_XOR_EXPR:
+ case TRUTH_NOT_EXPR:
case COND_EXPR:
t = fix_conditional_array_notations (t);
@@ -1246,8 +1254,6 @@ expand_array_notation_exprs (tree t)
COND_EXPR_ELSE (t) =
expand_array_notation_exprs (COND_EXPR_ELSE (t));
}
- else
- t = expand_array_notation_exprs (t);
return t;
case STATEMENT_LIST:
{
@@ -1284,6 +1290,10 @@ expand_array_notation_exprs (tree t)
Replace those with just void zero node. */
t = void_zero_node;
default:
+ for (int ii = 0; ii < TREE_CODE_LENGTH (TREE_CODE (t)); ii++)
+ if (contains_array_notation_expr (TREE_OPERAND (t, ii)))
+ TREE_OPERAND (t, ii) =
+ expand_array_notation_exprs (TREE_OPERAND (t, ii));
return t;
}
return t;