]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/100786 - constant folding from incompatible alias
authorRichard Biener <rguenther@suse.de>
Thu, 20 Jan 2022 13:25:51 +0000 (14:25 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 21 Apr 2022 12:51:14 +0000 (14:51 +0200)
commit1e1b247774e0239f73b59e07f30db4e400f9b4eb
treeb0a508c7191dbd2dd6b34407b958f2c055c9a9e9
parent4ed8728e2646897c98826cf43be2e4682d04fc2c
middle-end/100786 - constant folding from incompatible alias

The following avoids us ICEing doing constant folding from variables
with aliases of different types.  The issue appears both in
folding and CCP and FRE can do more fancy stuff to still constant
fold cases where the load is smaller than the initializer so
defer it to there.

2022-01-20  Richard Biener  <rguenther@suse.de>

PR middle-end/100786
* gimple-fold.c (get_symbol_constant_value): Only return
values of compatible type to the symbol.

* gcc.dg/torture/pr100786.c: New testcase.

(cherry picked from commit 5c12507f5d0bc080e4f346af99824e039236e61c)
gcc/gimple-fold.c
gcc/testsuite/gcc.dg/torture/pr100786.c [new file with mode: 0644]