Fix ICE in verify_sra_access_forest
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 15 Jun 2020 17:42:11 +0000 (19:42 +0200)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 15 Jun 2020 17:54:01 +0000 (19:54 +0200)
commitfb149ebdfee8995ed091f17cd64355ff54e9fb30
tree4e4998067c3c8211f0e44cc3138318e98ad4bcdb
parentb6ab9ecd550227684643b41e9e33a4d3466724d8
Fix ICE in verify_sra_access_forest

This fixes an issue with reverse storage order in SRA, which is caught
by the built-in verifier in verify_sra_access_forest.  The problem is
that propagate_subaccesses_from_rhs changes the type of an access
from aggregate to scalar and, as discussed elsewhere, this must be
done with extra care in the presence of reverse storage order.

gcc/ChangeLog
* tree-sra.c (propagate_subaccesses_from_rhs): When a non-scalar
access on the LHS is replaced with a scalar access, propagate the
TYPE_REVERSE_STORAGE_ORDER flag of the type of the original access.

gcc/testsuite/ChangeLog
* gnat.dg/opt85.ads, gnat.dg/opt85.adb: New test.
gcc/testsuite/gnat.dg/opt85.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/opt85.ads [new file with mode: 0644]
gcc/tree-sra.c