public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Compiler abort on nested instantions with pragma Ignore_Pragma.
@ 2017-04-25 13:06 Arnaud Charlet
  0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2017-04-25 13:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ed Schonberg

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

This patch fixes a crash in a compilation involving nested generics when
a generic subprogram carries an Inline_Always pragma, and a configuration
file has a corresponding pragma Ignore_Pragma (Inline_Always).

No small example available.

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

2017-04-25  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch12.adb (Load_Parent_Of_Generic); When retrieving the
	declaration of a subprogram instance within its wrapper package,
	skip over null statements that may result from the rewriting of
	ignored pragmas.


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 2934 bytes --]

Index: sem_ch12.adb
===================================================================
--- sem_ch12.adb	(revision 247182)
+++ sem_ch12.adb	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2016, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2017, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -13217,8 +13217,8 @@
                --  package, in which case the usual generic rule applies.
 
                declare
-                  Exp_Status         : Boolean := True;
-                  Scop               : Entity_Id;
+                  Exp_Status : Boolean := True;
+                  Scop       : Entity_Id;
 
                begin
                   --  Loop through scopes looking for generic package
@@ -13292,8 +13292,7 @@
 
                            --  Package instance
 
-                           if
-                             Nkind (Node (Decl)) = N_Package_Instantiation
+                           if Nkind (Node (Decl)) = N_Package_Instantiation
                            then
                               Instantiate_Package_Body
                                 (Info, Body_Optional => True);
@@ -13308,8 +13307,9 @@
                               --  these result in the corresponding pragmas,
                               --  inserted after the subprogram declaration.
                               --  They must be skipped as well when retrieving
-                              --  the desired spec. A direct link would be
-                              --  more robust ???
+                              --  the desired spec. Some of them may have been
+                              --  rewritten as null statements.
+                              --  A direct link would be more robust ???
 
                               declare
                                  Decl : Node_Id :=
@@ -13317,7 +13317,9 @@
                                             (Specification (Info.Act_Decl))));
                               begin
                                  while Nkind_In (Decl,
-                                   N_Subprogram_Renaming_Declaration, N_Pragma)
+                                   N_Null_Statement,
+                                   N_Pragma,
+                                   N_Subprogram_Renaming_Declaration)
                                  loop
                                     Decl := Prev (Decl);
                                  end loop;

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

only message in thread, other threads:[~2017-04-25 13:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25 13:06 [Ada] Compiler abort on nested instantions with pragma Ignore_Pragma Arnaud Charlet

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