From: Eric Botcazou Date: Sun, 13 Nov 2016 18:29:45 +0000 (+0000) Subject: decl.c (gnat_to_gnu_entity): Look at the underlying type for the signedness of the... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=476053121ba5fc4840146ef05a89636f5d37178c;p=gcc.git decl.c (gnat_to_gnu_entity): Look at the underlying type for the signedness of the type. * gcc-interface/decl.c (gnat_to_gnu_entity) : Look at the underlying type for the signedness of the type. From-SVN: r242361 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b3ac97c67c8..695518d5552 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2016-11-13 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : + Look at the underlying type for the signedness of the type. + 2016-11-13 Eric Botcazou * gcc-interface/decl.c (annotate_value) : Deal specially diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index b6fce3ecf35..c023e31a6d2 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1836,7 +1836,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && 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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a273920d43b..0ae7b97cd57 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-11-13 Eric Botcazou + + * gnat.dg/address_conv.adb: New test. + 2016-11-13 Eric Botcazou * gnat.dg/renaming11.ad[sb]: New test. diff --git a/gcc/testsuite/gnat.dg/address_conv.adb b/gcc/testsuite/gnat.dg/address_conv.adb new file mode 100644 index 00000000000..27b3dada9ab --- /dev/null +++ b/gcc/testsuite/gnat.dg/address_conv.adb @@ -0,0 +1,19 @@ +-- { 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;