public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Fix immediate assertion failure with -gnatd.1
@ 2022-09-12  8:19 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2022-09-12  8:19 UTC (permalink / raw)
  To: gcc-patches; +Cc: Eric Botcazou

[-- Attachment #1: Type: text/plain, Size: 211 bytes --]

The switch enables the front-end unnesting pass.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* gcc-interface/decl.cc (gnat_to_gnu_entity): Relax assertion when
	front-end unnesting is enabled.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 1259 bytes --]

diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -436,7 +436,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
   /* 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.  */
+     another GNAT type is used to lay out the GCC type for them, as well as
+     access-to-subprogram types if front-end unnesting is enabled.  */
   gcc_assert (!is_type
 	      || Known_Esize (gnat_entity)
 	      || Has_Size_Clause (gnat_entity)
@@ -445,6 +446,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
 		  && (!IN (kind, Access_Kind)
 		      || kind == E_Access_Protected_Subprogram_Type
 		      || kind == E_Anonymous_Access_Protected_Subprogram_Type
+		      || ((kind == E_Access_Subprogram_Type
+			   || kind == E_Anonymous_Access_Subprogram_Type)
+			  && Unnest_Subprogram_Mode)
 		      || kind == E_Access_Subtype
 		      || type_annotate_only)));
 



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-12  8:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-12  8:19 [Ada] Fix immediate assertion failure with -gnatd.1 Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).