diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-12-01 00:43:10 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-12-01 00:43:10 +0100 |
commit | cc6534d40136b8afb5dcd878e58d106f31b51dd2 (patch) | |
tree | 45bebb503a52bf8726cdc05432ea9875c8ef1bdd /gcc/c/c-fold.c | |
parent | 5de73c050e4dbb3dfc8705bf20199aedb090df20 (diff) | |
download | gcc-cc6534d40136b8afb5dcd878e58d106f31b51dd2.zip gcc-cc6534d40136b8afb5dcd878e58d106f31b51dd2.tar.gz gcc-cc6534d40136b8afb5dcd878e58d106f31b51dd2.tar.bz2 |
re PR c/83222 (Inconsistent "initializer element is not constant" error)
PR c/83222
* c-tree.h (decl_constant_value_1): Declare.
* c-typeck.c (decl_constant_value_1): New function.
(decl_constant_value): Use it.
* c-fold.c (c_fully_fold_internal): If in_init, use
decl_constant_value_1 instead of decl_constant_value.
* gcc.c-torture/compile/pr83222.c: New test.
From-SVN: r255285
Diffstat (limited to 'gcc/c/c-fold.c')
-rw-r--r-- | gcc/c/c-fold.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/c/c-fold.c b/gcc/c/c-fold.c index 8895462..84ce543 100644 --- a/gcc/c/c-fold.c +++ b/gcc/c/c-fold.c @@ -167,7 +167,10 @@ c_fully_fold_internal (tree expr, bool in_init, bool *maybe_const_operands, /* Except for variables which we can optimize to its initializer. */ if (VAR_P (expr) && !lval && (optimize || in_init)) { - ret = decl_constant_value (expr); + if (in_init) + ret = decl_constant_value_1 (expr); + else + ret = decl_constant_value (expr); /* Avoid unwanted tree sharing between the initializer and current function's body where the tree can be modified e.g. by the gimplifier. */ |