This occurs because System.Address is a private type so you need to invoke
Underlying_Type before testing whether it is unsigned.
Fixed thusly, tested on x86_64-suse-linux, applied on the mainline.
2016-11-13 Eric Botcazou <ebotca...@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity)<E_Signed_Integer_Subtype>:
Look at the underlying type for the signedness of the type.
2016-11-13 Eric Botcazou <ebotca...@adacore.com>
* gnat.dg/address_conv.adb: New test.
--
Eric Botcazou
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 242360)
+++ gcc-interface/decl.c (working copy)
@@ -1836,7 +1836,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
&& esize == CHAR_TYPE_SIZE
&& flag_signed_char)
gnu_type = make_signed_type (CHAR_TYPE_SIZE);
- else if (Is_Unsigned_Type (Etype (gnat_entity))
+ else if (Is_Unsigned_Type (Underlying_Type (Etype (gnat_entity)))
|| (Esize (Etype (gnat_entity)) != Esize (gnat_entity)
&& Is_Unsigned_Type (gnat_entity))
|| Has_Biased_Representation (gnat_entity))
-- { dg-do compile }
with System.Storage_Elements; use System.Storage_Elements;
procedure Address_Conv is
subtype My_Address is System.Address;
type Rec is record
A : My_Address;
end record;
Addr : constant My_Address := To_Address (16#FACEFACE#);
R : constant Rec := (A => Addr);
begin
null;
end;