diff options
author | Samuel Tardieu <sam@rfc1149.net> | 2008-04-09 14:21:18 +0000 |
---|---|---|
committer | Samuel Tardieu <sam@gcc.gnu.org> | 2008-04-09 14:21:18 +0000 |
commit | ce4e59c46ba3989a420afca61ddcf9550e02ab7f (patch) | |
tree | 1df1a59c24593585213fab7e8e0190a93d6bb053 /gcc/ada | |
parent | 3a3a1fe1f8ed06d2ea69734c8f22a874eeb80b36 (diff) | |
download | gcc-ce4e59c46ba3989a420afca61ddcf9550e02ab7f.tar.gz |
re PR ada/28305 (GNAT bug when inlining instance of a generic subprogram)
gcc/ada/
PR ada/28305
* sem_ch6.adb (Build_Body_To_Inline): Do not save and restore
environment if generic instance is a top-level one.
gcc/testsuite/
PR ada/28305
* gnat.dg/specs/fe_inlining.ads, gnat.dg/specs/fe_inlining_helper.ads,
gnat.dg/specs/fe_inlining_helper.adb: New test.
From-SVN: r134142
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/sem_ch6.adb | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index fe17591183e..f659d3303ea 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2008-04-09 Samuel Tardieu <sam@rfc1149.net> + + PR ada/28305 + * sem_ch6.adb (Build_Body_To_Inline): Do not save and restore + environment if generic instance is a top-level one. + 2008-04-09 Doug Rupp <rupp@adacore.com> * decl.c (validate_size): Set minimum size for fat pointers same as diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 759607e7246..668a2a7b204 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -2929,7 +2929,11 @@ package body Sem_Ch6 is -- Within an instance, the body to inline must be treated as a nested -- generic, so that the proper global references are preserved. - if In_Instance then + -- Note that we do not do this at the library level, because it is not + -- needed, and furthermore this causes trouble if front end inlining + -- is activated (-gnatN). + + if In_Instance and then Scope (Current_Scope) /= Standard_Standard then Save_Env (Scope (Current_Scope), Scope (Current_Scope)); Original_Body := Copy_Generic_Node (N, Empty, True); else @@ -2977,7 +2981,9 @@ package body Sem_Ch6 is Expander_Mode_Restore; - if In_Instance then + -- Restore environment if previously saved + + if In_Instance and then Scope (Current_Scope) /= Standard_Standard then Restore_Env; end if; |