exp_ch6.adb (Expand_N_Function_Call): If stack checking is enabled...
authorEd Schonberg <schonber@gnat.com>
Mon, 4 Oct 2004 14:56:49 +0000 (16:56 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 4 Oct 2004 14:56:49 +0000 (16:56 +0200)
2004-10-04  Ed Schonberg  <schonberg@gnat.com>

* exp_ch6.adb (Expand_N_Function_Call): If stack checking is enabled,
do not generate a declaration for a temporary if the call is part of a
library-level instantiation.

From-SVN: r88495

gcc/ada/ChangeLog
gcc/ada/exp_ch6.adb

index fbd3a898f841468364313bc4c8907478cad41d47..8daf6baca78ec00e2e187b34951bbbec249426ce 100644 (file)
@@ -1,3 +1,9 @@
+2004-10-04  Ed Schonberg  <schonberg@gnat.com>
+
+       * exp_ch6.adb (Expand_N_Function_Call): If stack checking is enabled,
+       do not generate a declaration for a temporary if the call is part of a
+       library-level instantiation.
+
 2004-10-04  Ed Schonberg  <schonberg@gnat.com>
 
        * sem_util.adb (Explain_Limited_Type): Ignore internal components when
index df976adec6f68542655d6367d500cec3b7fe8d93..4980155f275ccdb896490a7c7c1a48c3ac24fc48 100644 (file)
@@ -2934,6 +2934,12 @@ package body Exp_Ch6 is
       --  this because otherwise gigi may generate a large temporary on the
       --  fly and this can cause trouble with stack checking.
 
+      --  This is unecessary if the call is the expression in an object
+      --  declaration, or if it appears outside of any library unit. This
+      --  can only happen if it appears as an actual in a library-level
+      --  instance, in which case a temporary will be generated for it once
+      --  the instance itself is installed.
+
       if May_Generate_Large_Temp (Typ)
         and then Nkind (Parent (N)) /= N_Assignment_Statement
         and then
@@ -2943,6 +2949,7 @@ package body Exp_Ch6 is
           (Nkind (Parent (N)) /= N_Object_Declaration
              or else Expression (Parent (N)) /= N)
         and then not Returned_By_Reference
+        and then Current_Scope /= Standard_Standard
       then
          if Stack_Checking_Enabled then