re PR c++/71372 (C++ FE drops TREE_THIS_VOLATILE in cp_fold on all tcc_reference...
authorJakub Jelinek <jakub@redhat.com>
Thu, 2 Jun 2016 16:36:04 +0000 (18:36 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 2 Jun 2016 16:36:04 +0000 (18:36 +0200)
commit0633ee10ed6a1b53f5adde1f5832634cd51d26f7
tree0a05305ad09d3624641409f3653039f434615285
parent4ae1c663d45fd14498aa6f60ba22d4e5fb8495ab
re PR c++/71372 (C++ FE drops TREE_THIS_VOLATILE in cp_fold on all tcc_reference trees)

PR c++/71372
* cp-gimplify.c (cp_fold): For INDIRECT_REF, if the folded expression
is INDIRECT_REF or MEM_REF, copy over TREE_READONLY, TREE_SIDE_EFFECTS
and TREE_THIS_VOLATILE flags.  For ARRAY_REF and ARRAY_RANGE_REF, copy
over TREE_READONLY, TREE_SIDE_EFFECTS and TREE_THIS_VOLATILE flags
to the newly built tree.

* c-c++-common/pr71372.c: New test.

From-SVN: r237041
gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/pr71372.c [new file with mode: 0644]