Patchwork [Ada] Disable assertion in ASIS mode

login
register
mail settings
Submitter Eric Botcazou
Date May 26, 2013, 10:21 a.m.
Message ID <3618340.4mk7tOxH53@polaris>
Download mbox | patch
Permalink /patch/246389/
State New
Headers show

Comments

Eric Botcazou - May 26, 2013, 10:21 a.m.
The assertion is too strong in ASIS mode, where all the types aren't laid out.

Tested on x86_64-suse-linux, applied on the mainline.


2013-05-26  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c: (gnat_to_gnu_entity): In ASIS mode, do not
	check that access types have a set size.

Patch

Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 199342)
+++ gcc-interface/decl.c	(working copy)
@@ -311,8 +311,10 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
       return gnu_decl;
     }
 
-  /* If this is a numeric or enumeral type, or an access type, a nonzero
-     Esize must be specified unless it was specified by the programmer.  */
+  /* If this is a numeric or enumeral type, or an access type, a nonzero Esize
+     must be specified unless it was specified by the programmer.  Exceptions
+     are for access-to-protected-subprogram types and all access subtypes, as
+     another GNAT type is used to lay out the GCC type for them.  */
   gcc_assert (!Unknown_Esize (gnat_entity)
 	      || Has_Size_Clause (gnat_entity)
 	      || (!IN (kind, Numeric_Kind)
@@ -320,7 +322,8 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 		  && (!IN (kind, Access_Kind)
 		      || kind == E_Access_Protected_Subprogram_Type
 		      || kind == E_Anonymous_Access_Protected_Subprogram_Type
-		      || kind == E_Access_Subtype)));
+		      || kind == E_Access_Subtype
+		      || type_annotate_only)));
 
   /* The RM size must be specified for all discrete and fixed-point types.  */
   gcc_assert (!(IN (kind, Discrete_Or_Fixed_Point_Kind)