This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Ada: fix wrong code generated for small strings passed by reference

> > 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 
damage it.

Eric Botcazou

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]