public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Front-end inlining and instantiations of UC
@ 2021-07-07 16:25 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-07-07 16:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Arnaud Charlet

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

A recent change exposed a latent bug where the Is_Intrinsic_Subprogram
flag was not propagated properly, leading to errors from the front-end
inlining of the form:

   cannot inline "xxx" (nested function instantiation)

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

gcc/ada/

	* sem_ch12.adb (Analyze_Subprogram_Instantiation): Mark Anon_Id
	intrinsic before calling Analyze_Instance_And_Renamings because
	this flag may be propagated to other nodes.

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

diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -5796,6 +5796,14 @@ package body Sem_Ch12 is
             Set_SPARK_Mode (Gen_Unit);
          end if;
 
+         --  Need to mark Anon_Id intrinsic before calling
+         --  Analyze_Instance_And_Renamings because this flag may be propagated
+         --  to other nodes.
+
+         if Is_Intrinsic_Subprogram (Gen_Unit) then
+            Set_Is_Intrinsic_Subprogram (Anon_Id);
+         end if;
+
          Analyze_Instance_And_Renamings;
 
          --  Restore SPARK_Mode from the context after analysis of the package
@@ -5817,7 +5825,6 @@ package body Sem_Ch12 is
          --  not within the main unit.
 
          if Is_Intrinsic_Subprogram (Gen_Unit) then
-            Set_Is_Intrinsic_Subprogram (Anon_Id);
             Set_Is_Intrinsic_Subprogram (Act_Decl_Id);
 
             if Chars (Gen_Unit) = Name_Unchecked_Conversion then



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

only message in thread, other threads:[~2021-07-07 16:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-07 16:25 [Ada] Front-end inlining and instantiations of UC Pierre-Marie de Rodat

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