middle-end/100509 - avoid folding constant to aggregate type
authorRichard Biener <rguenther@suse.de>
Tue, 11 May 2021 08:58:35 +0000 (10:58 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 11 May 2021 10:48:05 +0000 (12:48 +0200)
commitca8e8301180fa71de1a76769fc038df2ab85dfeb
treef6badc25ee1b91ebc8d74ef1ade19a8c53c4f6cc
parent9b905ba9ebba8d2cc805c26351225e7f74c02333
middle-end/100509 - avoid folding constant to aggregate type

When folding a constant initializer looking through aliases to
incompatible types can lead to us trying to fold a constant
to an aggregate type which can't work.  Simply avoid trying
to constant fold non-register typed symbols.

2021-05-11  Richard Biener  <rguenther@suse.de>

PR middle-end/100509
* gimple-fold.c (fold_gimple_assign): Only call
get_symbol_constant_value on register type symbols.

* gcc.dg/pr100509.c: New testcase.
gcc/gimple-fold.c
gcc/testsuite/gcc.dg/pr100509.c [new file with mode: 0644]