diff options
author | Jakub Jelinek <jakub@redhat.com> | 2017-11-19 18:17:01 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2017-11-19 18:17:01 +0100 |
commit | f9c59f7e9511856bd6dc13d2d4904ebd9249c095 (patch) | |
tree | 418d66f5607f88d0a122bfdd9c9fe4038f93d9f8 /gcc/c-family | |
parent | 4397fc04e399e91fe53f0862fef41bb5b42a7c14 (diff) | |
download | gcc-f9c59f7e9511856bd6dc13d2d4904ebd9249c095.zip gcc-f9c59f7e9511856bd6dc13d2d4904ebd9249c095.tar.gz gcc-f9c59f7e9511856bd6dc13d2d4904ebd9249c095.tar.bz2 |
re PR c/66618 (Failure to diagnose non-constant initializer for static object with -O1)
PR c/66618
PR c/69960
c-family/
* c-common.h (c_fully_fold): Add LVAL argument defaulted to false.
c/
* c-parser.c (c_parser_omp_atomic): Pass true as LVAL to c_fully_fold
where needed.
* c-typeck.c (build_unary_op, build_modify_expr, build_asm_expr,
handle_omp_array_sections): Likewise.
(digest_init): Don't call decl_constant_value_for_optimization.
* c-tree.h (decl_constant_value_for_optimization): Removed.
* c-fold.c (c_fold_array_ref): New function.
(c_fully_fold_internal): Add LVAL argument, propagate it through
recursive calls. For VAR_P call decl_constant_value and
unshare if not LVAL and either optimizing or IN_INIT. Remove
decl_constant_value_for_optimization calls. If IN_INIT and not LVAL,
fold ARRAY_REF with STRING_CST and INTEGER_CST operands.
(c_fully_fold): Add LVAL argument, pass it through to
c_fully_fold_internal.
(decl_constant_value_for_optimization): Removed.
cp/
* cp-gimplify.c (c_fully_fold): Add LVAL argument, call
cp_fold_maybe_rvalue instead of cp_fold_rvalue and pass it !LVAL.
testsuite/
* gcc.dg/pr69960.c: New test.
* gcc.dg/pr66618.c: New test.
* gcc.dg/pr66618-2.c: New test.
From-SVN: r254930
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-family/c-common.h | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 990cd61..7323a7d 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2017-11-19 Jakub Jelinek <jakub@redhat.com> + + PR c/66618 + PR c/69960 + * c-common.h (c_fully_fold): Add LVAL argument defaulted to false. + 2017-11-16 Joseph Myers <joseph@codesourcery.com> * c.opt (-std=c17, std=gnu17, -std=iso9899:2017): Refer to 2018 diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h index 5bb8619..c86c659 100644 --- a/gcc/c-family/c-common.h +++ b/gcc/c-family/c-common.h @@ -828,7 +828,7 @@ extern tree c_build_bitfield_integer_type (unsigned HOST_WIDE_INT, int); extern enum conversion_safety unsafe_conversion_p (location_t, tree, tree, tree, bool); extern bool decl_with_nonnull_addr_p (const_tree); -extern tree c_fully_fold (tree, bool, bool *); +extern tree c_fully_fold (tree, bool, bool *, bool = false); extern tree c_wrap_maybe_const (tree, bool); extern tree c_common_truthvalue_conversion (location_t, tree); extern void c_apply_type_quals_to_decl (int, tree); |