This is the mail archive of the
mailing list for the GCC project.
[C++11][4.9] Add missing REDUC_PLUS_EXPR case to potential_constant_expression_1.
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: jason at redhat dot com, mark at codesourcery dot com
- Date: Thu, 14 Mar 2013 13:48:50 +0000
- Subject: [C++11][4.9] Add missing REDUC_PLUS_EXPR case to potential_constant_expression_1.
As it stands, potential_constant_expression_1 does not handle
For some cross-lane add-reduce neon intrinsics we would like to
use the TARGET_FOLD_BUILTIN hook to fold these calls to a
REDUC_PLUS_EXPR. As an example, see Tejas Belagod's patch at:
If we do that, the C++11 front-end is not able to evaluate
them as a potential constant expression and we get an
"unexpected AST of kind REDUC_PLUS_EXPR" error.
I am about as far from a C++11 expert as you can get, so I
don't know whether this is the correct fix, but to my naieve
mind I don't see why REDUC_PLUS_EXPR is different from any
other unary operator...
I have tested the patch on aarch64-none-elf with no regressions,
and it fixed the problem I was seeing previously.
Is this OK to commit to 4.9 when stage 1 opens up?
(potential_constant_expression_1): Add case for REDUC_PLUS_EXPR.
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 9446f83..232057a 100644
@@ -8600,6 +8600,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
+ case REDUC_PLUS_EXPR:
return potential_constant_expression_1 (TREE_OPERAND (t, 0), rval,