decl.c (gnat_to_gnu_entity): Look at the underlying type for the signedness of the...
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 13 Nov 2016 18:29:45 +0000 (18:29 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 13 Nov 2016 18:29:45 +0000 (18:29 +0000)
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Signed_Integer_Subtype>:
Look at the underlying type for the signedness of the type.

From-SVN: r242361

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/address_conv.adb [new file with mode: 0644]

index b3ac97c67c880096b81ea4afb9318b360d4ba269..695518d5552847184a4677ee88bc976c697a5c22 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-13  Eric Botcazou  <ebotcazou@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  <ebotcazou@adacore.com>
 
        * gcc-interface/decl.c (annotate_value) <INTEGER_CST>: Deal specially
index b6fce3ecf351c5ce29c37fe9994bf6f905e23fb2..c023e31a6d238ff5ddf53e5ec6fc754cbf2593f5 100644 (file)
@@ -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))
index a273920d43b5bf7280f6a0a459eaaa75d2e26562..0ae7b97cd57c9a334a08d1f6f9b1bb757eee6b60 100644 (file)
@@ -1,3 +1,7 @@
+2016-11-13  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/address_conv.adb: New test.
+
 2016-11-13  Eric Botcazou  <ebotcazou@adacore.com>
 
        * 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 (file)
index 0000000..27b3dad
--- /dev/null
@@ -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;