public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Arnaud Charlet <charlet@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Ed Schonberg <schonberg@adacore.com>
Subject: [Ada] Compiler abort on nested instantions with pragma Ignore_Pragma.
Date: Tue, 25 Apr 2017 13:06:00 -0000	[thread overview]
Message-ID: <20170425130519.GA69327@adacore.com> (raw)

[-- 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;

                 reply	other threads:[~2017-04-25 13:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170425130519.GA69327@adacore.com \
    --to=charlet@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=schonberg@adacore.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).