diff options
author | Balaji V. Iyer <balaji.v.iyer@intel.com> | 2013-08-20 01:10:56 +0000 |
---|---|---|
committer | Balaji V. Iyer <bviyer@gcc.gnu.org> | 2013-08-19 18:10:56 -0700 |
commit | 318cda8521f7c4a390d42c3cd0cbba427a01eda7 (patch) | |
tree | 313e7fa61465ceac80856ae997ce3ae03f2e5254 /gcc/cp/call.c | |
parent | e42c64cb6dca35a4979db08706033d89b94f196f (diff) | |
download | gcc-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/call.c')
-rw-r--r-- | gcc/cp/call.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index e493a79..df87d8f 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7177,6 +7177,33 @@ build_cxx_call (tree fn, int nargs, tree *argarray, && !check_builtin_function_arguments (fndecl, nargs, argarray)) return error_mark_node; + /* If it is a built-in array notation function, then the return type of + the function is the element type of the array passed in as array + notation (i.e. the first parameter of the function). */ + if (flag_enable_cilkplus && TREE_CODE (fn) == CALL_EXPR) + { + enum built_in_function bif = + is_cilkplus_reduce_builtin (CALL_EXPR_FN (fn)); + if (bif == BUILT_IN_CILKPLUS_SEC_REDUCE_ADD + || bif == BUILT_IN_CILKPLUS_SEC_REDUCE_MUL + || bif == BUILT_IN_CILKPLUS_SEC_REDUCE_MAX + || bif == BUILT_IN_CILKPLUS_SEC_REDUCE_MIN + || bif == BUILT_IN_CILKPLUS_SEC_REDUCE + || bif == BUILT_IN_CILKPLUS_SEC_REDUCE_MUTATING) + { + /* for bif == BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_ZERO or + BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_ZERO or + BUILT_IN_CILKPLUS_SEC_REDUCE_ANY_NONZERO or + BUILT_IN_CILKPLUS_SEC_REDUCE_ALL_NONZERO or + BUILT_IN_CILKPLUS_SEC_REDUCE_MIN_IND or + BUILT_IN_CILKPLUS_SEC_REDUCE_MAX_IND + The pre-defined return-type is the correct one. */ + tree array_ntn = CALL_EXPR_ARG (fn, 0); + TREE_TYPE (fn) = TREE_TYPE (array_ntn); + return fn; + } + } + /* Some built-in function calls will be evaluated at compile-time in fold (). Set optimize to 1 when folding __builtin_constant_p inside a constexpr function so that fold_builtin_1 doesn't fold it to 0. */ |