This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Ada: fix wrong code generated for small strings passed by reference
- From: ja2morri at csclub dot uwaterloo dot ca (James A. Morrison)
- To: Arnaud Charlet <charlet at ACT-Europe dot FR>
- Cc: gcc-patches at gcc dot gnu dot org, Eric Botcazou <ebotcazou at ACT-Europe dot FR>
- Date: 21 Nov 2004 18:54:52 -0500
- Subject: Re: Ada: fix wrong code generated for small strings passed by reference
- References: <20041027101550.GC91230@province.act-europe.fr>
Arnaud Charlet <charlet@ACT-Europe.FR> writes:
> Tested on x86-linux
>
> The compiler generated wrong code for
> Blank_8_Str : aliased constant String := (1 .. 8 => <space>);
> S : aliased String := Blank_8_Str;
> subtype Small_String is String (1 .. 8);
> when S is passed by reference as an (in-)out parameter of type Small_String.
> Objects like S are a bit special: they are formally constrained, yet gigi
> builds a template type for them because they are aliased. When the function
> call is built, the argument must be converted back to the constrained form of
> the type before its address can be taken, as prescribed by the signature of
> the function.
Do you have a complete test case for this?
--
Thanks,
Jim
http://www.student.cs.uwaterloo.ca/~ja2morri/
http://phython.blogspot.com
http://open.nit.ca/wiki/?page=jim