]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix misoptimization of CONSTRUCTOR with reverse SSO
authorEric Botcazou <ebotcazou@adacore.com>
Fri, 27 Jun 2025 21:47:49 +0000 (23:47 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Fri, 27 Jun 2025 21:54:08 +0000 (23:54 +0200)
commit570b63276f6434df59c52da36b1581eb8b516762
tree5caa3b9a2c5d30a313018b41b86937097502edcd
parentc846f9d5d6ff7b8a634004f33392cd8bc5760e20
Fix misoptimization of CONSTRUCTOR with reverse SSO

fold_ctor_reference already punts on a CONSTRUCTOR whose type has reverse
storage order, but it can be invoked in a couple of places on a CONSTRUCTOR
with native storage order that has been wrapped in a VIEW_CONVERT_EXPR to a
type with reverse storage order; this would require a post adjustment that
does not currently exist, thus yield wrong code for this admittedly quite
pathological (but supported) case.

gcc/
* gimple-fold.cc (fold_const_aggregate_ref_1) <COMPONENT_REF>:
Bail out immediately if the reference has reverse storage order.
* tree-ssa-sccvn.cc (fully_constant_vn_reference_p): Likewise.
gcc/testsuite/
* gnat.dg/sso20.adb: New test.
gcc/gimple-fold.cc
gcc/testsuite/gnat.dg/sso20.adb [new file with mode: 0644]
gcc/tree-ssa-sccvn.cc