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] | |
Tested on i686-linux, committed on mainline.
A type conversion from or to a bit-packed component type is expanded
differently depending on whether it is occurring on the left-hand side
of an assignment. When such a (view) conversion is used as the actual
for an 'out' or 'in out' parameter, its expansion must be deferred to
the point where the value is assigned after the subprogram returns,
or else incorrect code is generated for the returned value assignment.
Test case: the following program must compile and display "PASS"
with Ada.Text_IO;
procedure Tryit is
type My_Int is new Natural range 0 .. 400;
for My_Int'Size use 14;
type My_Array_Type is array (Natural range <>) of My_Int;
for My_Array_Type'Component_Size use 14;
pragma Pack (My_Array_Type);
procedure Copy (From : in Integer; Into : out Integer) is
begin
Into := From;
end Copy;
My_Array : My_Array_Type (1..3) := (others => 0);
My_Into : Integer := 0;
begin
Copy (From => 123, Into => Integer(My_Array(1)));
if Integer (My_Array (1)) = 123 then
Ada.Text_IO.Put_Line ("PASS");
else
Ada.Text_IO.Put_Line ("FAIL");
end if;
end Tryit;
2005-07-04 Thomas Quinot <quinot@adacore.com>
* sem_res.adb (Resolve_Actuals): Do not resolve the expression of an
actual that is a view conversion of a bit packed array reference.
Attachment:
difs.20
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |