This is the mail archive of the gcc-patches@gcc.gnu.org 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]

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


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.

2004-10-26  Eric Botcazou  <ebotcazou@act-europe.fr>

	* trans.c (call_to_gnu): For an (in-)out parameter passed by reference
	whose type is a constructed subtype of an aliased object with an
	unconstrained nominal subtype, convert the actual to the constructed
	subtype before taking its address.

Attachment: difs.35
Description: Text document


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