diff mbox

[Ada] Fix bogus warning on address conversion

Message ID 1502340.pf9qsBsV2P@polaris
State New
Headers show

Commit Message

Eric Botcazou Nov. 13, 2016, 6:30 p.m. UTC
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  <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>

	* gnat.dg/address_conv.adb: New test.

-- 
Eric Botcazou
diff mbox

Patch

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))