> Yes, it breaks Ada. I already found this out in the meanwhile.
OK, thanks for checking.
> My understanding of this is that this is for referring
> to some field of an outer struct which is then used in the
> size expression, e.g. something like this (using
> C syntax):
>
> struct foo {
> int len;
> float (*x)[3][len];
> };
Yes, just
struct foo {
int len;
float a[len];
}
but it's also used for unconstrained array types and this seems to be the
problem here, e.g. for:
package Vect1 is
type Varray is array (Integer range <>) of Long_Float;
for Varray'Alignment use 16;
procedure Add (X, Y : not null access Varray; R : not null access Varray);
end Vect1;
package body Vect1 is
procedure Add (X, Y : not null access Varray; R : not null access Varray)
is
begin
for I in X'Range loop
R(I) := X(I) + Y(I);
end loop;
end;
end Vect1;
> But then why would you gimplify the size expression before
> the base expression? I would assume that you also want
> to process the base expression first, because it is the
> source of the struct which we access in the size expression.
For the above testcase, we have a dangling PLACEHOLDER_EXPRs
+===========================GNAT BUG DETECTED==============================+
| 12.0.0 20210805 (experimental) [master revision e314cfc371d:
5eb84b79079:ead235f60139edc6eb408d8d083cbb15e417b447] (x86_64-suse-linux) GCC
error:|
| in gimplify_expr, at gimplify.c:15019 |
| Error detected around vect1.adb:6:23
probably because array_ref_low_bound, where it is normally eliminated, cannot
do its jub properly when it is called after the base expression is gimplified.
--
Eric Botcazou