aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cp-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/cp/cp-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/cp/cp-array-notation.c')
-rw-r--r--gcc/cp/cp-array-notation.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/gcc/cp/cp-array-notation.c b/gcc/cp/cp-array-notation.c
index eb6a70d..f4581f0 100644
--- a/gcc/cp/cp-array-notation.c
+++ b/gcc/cp/cp-array-notation.c
@@ -857,6 +857,19 @@ cp_expand_cond_array_notations (tree orig_stmt)
return error_mark_node;
}
}
+ else if (truth_value_p (TREE_CODE (orig_stmt)))
+ {
+ size_t left_rank = 0, right_rank = 0;
+ tree left_expr = TREE_OPERAND (orig_stmt, 0);
+ tree right_expr = TREE_OPERAND (orig_stmt, 1);
+ if (!find_rank (EXPR_LOCATION (left_expr), left_expr, left_expr, true,
+ &left_rank)
+ || !find_rank (EXPR_LOCATION (right_expr), right_expr, right_expr,
+ true, &right_rank))
+ return error_mark_node;
+ if (right_rank == 0 && left_rank == 0)
+ return orig_stmt;
+ }
if (!find_rank (EXPR_LOCATION (orig_stmt), orig_stmt, orig_stmt, true,
&rank))
@@ -1213,6 +1226,12 @@ expand_array_notation_exprs (tree t)
if (TREE_OPERAND (t, 0) == error_mark_node)
return TREE_OPERAND (t, 0);
return t;
+ case TRUTH_ANDIF_EXPR:
+ case TRUTH_ORIF_EXPR:
+ case TRUTH_AND_EXPR:
+ case TRUTH_OR_EXPR:
+ case TRUTH_XOR_EXPR:
+ case TRUTH_NOT_EXPR:
case COND_EXPR:
t = cp_expand_cond_array_notations (t);
if (TREE_CODE (t) == COND_EXPR)
@@ -1222,8 +1241,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 FOR_STMT:
if (contains_array_notation_expr (FOR_COND (t)))