]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/c/ChangeLog
c: Handle MEM_REF in c_fully_fold* [PR94179]
authorJakub Jelinek <jakub@redhat.com>
Mon, 16 Mar 2020 21:58:41 +0000 (22:58 +0100)
committerJakub Jelinek <jakub@redhat.com>
Mon, 16 Mar 2020 21:58:41 +0000 (22:58 +0100)
commitc015ff8ccaf3ee8e4f6393679ed790ed0df92873
treed8b570cffa193c1ce5b539e57157e231ead1df47
parentbae7b38cf8a21e068ad5c0bab089dedb78af3346
c: Handle MEM_REF in c_fully_fold* [PR94179]

The recent match.pd changes can generate a MEM_REF which can be seen by the
C FE folding routines.  Unlike the C++ FE, they weren't expected in the C FE
yet.  MEM_REF should be handled like INDIRECT_REF, except that it has two
operands rather than just one and that we should preserve the type of the
second operand.  Given that it already has to be an INTEGER_CST with pointer
type, I think we are fine, the recursive call should return the INTEGER_CST
unmodified and STRIP_TYPE_NOPS will not strip anything.

2020-03-16  Jakub Jelinek  <jakub@redhat.com>

PR c/94179
* c-fold.c (c_fully_fold_internal): Handle MEM_REF.

* gcc.c-torture/compile/pr94179.c: New test.
gcc/c/ChangeLog
gcc/c/c-fold.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr94179.c [new file with mode: 0644]