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 bug with variant record and pragma Pack


Tested on i686-linux, committed on trunk

This patches a bug which shows up if you have a subtype of a variant
record, and all fields of the subtype have component clauses. In this
situation the code attempted to reset the Is_Packed flag of the subtype
(and there is no such flag), and also to generate a junk warning.

This bug was always present with -gnatwr, and the latest change made
the situation worse by having the blowup occur even if -gnatwr is not
used.

The test program is:

package P is
    type R (A : Boolean) is record
       case A is
          when True => X : Integer;
          when False => Y : Integer;
       end case;
    end record;

    for R use record
       A at 0 range 0 .. 0;
       X at 4 range 0 .. 31;
    end record;

    pragma Pack (R);

    subtype G is R (True);
end P;

This should compile quietly with no warnings, with or without -gnatwr

2005-12-05  Robert Dewar  <dewar@adacore.com>

	* freeze.adb (Freeze_Record_Type): Only test for useless pack on record
	types, not on record subtypes.
	(Freeze_Entity): Code cleanup. Add barrier to the loop
	that generates the references for primitive operations. This allows to
	remove an unnecessary exception handler.
	Code reformatting and comment clean ups.

Attachment: difs.16
Description: Text document


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