]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Fix recent regression on array aggregate with dynamic subtype
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Dec 2018 15:49:23 +0000 (15:49 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 3 Dec 2018 15:49:23 +0000 (15:49 +0000)
commite2ec53e96087df543c2e3b3e1675542bbef58e9b
treed465b90df9ed80cbb9b228954cfacd6c8fd8eae7
parent699b2a73d89f7471e4c0b9b0856912f8f91aa168
[Ada] Fix recent regression on array aggregate with dynamic subtype

This prevents either a crash or an assertion failure in gigi on an array
with dynamic subtype that is wrongly flagged as static by the front-end
because of a recent improvement made in the handling of nested
aggregates.

The patch reuses the existing Static_Array_Aggregate predicate instead
of fixing the problematic test, pluging a few loopholes in the process.
The predicate is conservatively correct but should be good enough in
practice.

2018-12-03  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_aggr.adb (Convert_To_Positional): Use
Static_Array_Aggregate to decide whether to set
Compile_Time_Known_Aggregate on an already flat aggregate.
(Expand_Array_Aggregate): Remove test on
Compile_Time_Known_Aggregate that turns out to be dead and
simplify.
(Is_Static_Component): New predicate extracted from...
(Static_Array_Aggregate): ...here.  Test neither Is_Tagged_Type
nor Is_Controlled for the type, but test whether the component
type has discriminants.  Use the Is_Static_Component predicate
consistently for the positional and named cases.

gcc/testsuite/

* gnat.dg/array32.adb, gnat.dg/array32.ads: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266755 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ada/ChangeLog
gcc/ada/exp_aggr.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/array32.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array32.ads [new file with mode: 0644]