PR c/83801
commiteb2fdcf566d57e40382162f766cae3bb4e023d81
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Jan 2018 17:00:43 +0000 (13 17:00 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Jan 2018 17:00:43 +0000 (13 17:00 +0000)
tree5e1b4802d2cab1d24b857680da9e4057d37fc2d7
parent3f16f2e04276a95a2bcc75ee37922b941b96b336
PR c/83801
* c-tree.h (decl_constant_value_1): Add a bool argument.
* c-typeck.c (decl_constant_value_1): Add IN_INIT argument, allow
returning a CONSTRUCTOR if it is true.  Use error_operand_p.
(decl_constant_value): Adjust caller.
* c-fold.c (c_fully_fold_internal): If in_init, pass true to
decl_constant_value_1 as IN_INIT.  Otherwise, punt if
decl_constant_value returns initializer that has BLKmode or
array type.
(c_fully_fold_internal) <case COMPONENT_REF>: Fold if !lval.

* gcc.dg/pr83801.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256608 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/c/ChangeLog
gcc/c/c-fold.c
gcc/c/c-tree.h
gcc/c/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr83801.c [new file with mode: 0644]