------- Additional Comments From charlet at gcc dot gnu dot org  2005-03-30 
09:12 -------
Here is a further simplification of the test case:

procedure PQ is

   subtype C_ULong    is Interfaces.C.unsigned_long;
   type    C_Chtype   is new C_ULong;

   type Character_Attribute_Set is array (0 .. 47) of Boolean;
   pragma Pack (Character_Attribute_Set);
   
   type Attributed_Character is record
      Attr  : Character_Attribute_Set;
      Color : Character;
      Ch    : Character;
   end record;
   pragma Convention (C, Attributed_Character);
   --  This is the counterpart for the chtype in C.
   
   for Attributed_Character use record
      Attr  at 0 range  0 .. 47;
      Color at 0 range 48 .. 55;
      Ch    at 0 range 56 .. 63;
   end record;
   for Attributed_Character'Size use 64;
   
   function Chtype_To_AttrChar is new
     Ada.Unchecked_Conversion (C_Chtype, Attributed_Character);
   
   X : constant C_Chtype := 0;
   Y : Character_Attribute_Set;
begin
   Y := Chtype_To_AttrChar (X).Attr;
end PQ;

The expected output of the compilation is:
gcc -c pq.adb
pq.adb:27:04: warning: types for unchecked conversion have different sizes

I assume the incorrect code in the ncurses Ada binding has been fixed in
the mean time. Anyway, GNAT should not ICE here.

Arno

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14997

Reply via email to