This is the mail archive of the
mailing list for the GCC project.
Re: Ada: fix wrong code generated for small strings passed by reference
- From: Eric Botcazou <ebotcazou at act-europe dot fr>
- To: ja2morri at csclub dot uwaterloo dot ca (James A. Morrison)
- Cc: gcc-patches at gcc dot gnu dot org,Arnaud Charlet <charlet at ACT-Europe dot FR>
- Date: Mon, 22 Nov 2004 01:17:30 +0100
- Subject: Re: Ada: fix wrong code generated for small strings passed by reference
- References: <20041027101550.GC91230@province.act-europe.fr> <email@example.com>
> > 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?
Not really, the original testcase would need to be sanitized. However the bug
is very easy to trigger on the SPARC for example: passing S as an in-out
parameter and modifying it in the called function is sufficient to seriously