]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 8 Jul 2013 08:17:14 +0000 (10:17 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 8 Jul 2013 08:17:14 +0000 (10:17 +0200)
2013-07-08  Robert Dewar  <dewar@adacore.com>

* rtsfind.adb: Minor comment fix.

2013-07-08  Hristian Kirtchev  <kirtchev@adacore.com>

* sem_ch4.adb (Check_Ghost_Subprogram_Call): Do not check the placement
of a Ghost function call when the enclosing context is being
preanalyzed.

2013-07-08  Ed Schonberg  <schonberg@adacore.com>

* exp_ch6.adb (Expand_Inlined_Call, Process_Formals): If the
expression in a return statement is a numeric literal, qualify
it with the return type for proper resolution.

From-SVN: r200772

gcc/ada/ChangeLog
gcc/ada/exp_ch6.adb
gcc/ada/rtsfind.adb
gcc/ada/sem_ch4.adb

index ac3876e47d4541822713a00a7cc9a2943c89f9a3..b5089150855021845c71ecbc9dd7d6d147670866 100644 (file)
@@ -1,3 +1,19 @@
+2013-07-08  Robert Dewar  <dewar@adacore.com>
+
+       * rtsfind.adb: Minor comment fix.
+
+2013-07-08  Hristian Kirtchev  <kirtchev@adacore.com>
+
+       * sem_ch4.adb (Check_Ghost_Subprogram_Call): Do not check the placement
+       of a Ghost function call when the enclosing context is being
+       preanalyzed.
+
+2013-07-08  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_ch6.adb (Expand_Inlined_Call, Process_Formals): If the
+       expression in a return statement is a numeric literal, qualify
+       it with the return type for proper resolution.
+
 2013-07-08  Robert Dewar  <dewar@adacore.com>
 
        * sem.ads: Minor comment updates.
index d944ac9ca08ee80ccc4cf723e82eb14f991e6c0f..d48544fdadae6d03e1e87bad571d3bbd69e40dc9 100644 (file)
@@ -4680,7 +4680,8 @@ package body Exp_Ch6 is
 
       function Process_Formals (N : Node_Id) return Traverse_Result;
       --  Replace occurrence of a formal with the corresponding actual, or the
-      --  thunk generated for it.
+      --  thunk generated for it. Replace a return statement with an assignment
+      --  to the target of the call, with appropriate conversions if needed.
 
       function Process_Sloc (Nod : Node_Id) return Traverse_Result;
       --  If the call being expanded is that of an internal subprogram, set the
@@ -4808,9 +4809,14 @@ package body Exp_Ch6 is
                --  errors, e.g. when the expression is a numeric literal and
                --  the context is private. If the expression is an aggregate,
                --  use a qualified expression, because an aggregate is not a
-               --  legal argument of a conversion.
+               --  legal argument of a conversion. Ditto for numeric literals,
+               --  which must be resolved to a specific type.
 
-               if Nkind_In (Expression (N), N_Aggregate, N_Null) then
+               if Nkind_In (Expression (N), N_Aggregate,
+                                            N_Null,
+                                            N_Real_Literal,
+                                            N_Integer_Literal)
+               then
                   Ret :=
                     Make_Qualified_Expression (Sloc (N),
                       Subtype_Mark => New_Occurrence_Of (Ret_Type, Sloc (N)),
index ecd1cd6b4e8a998527cf031e2d31934c90236eef..22abb9a581f9c9e9e75b3ead1bc956431b9c3e7d 100644 (file)
@@ -839,8 +839,8 @@ package body Rtsfind is
          return;
       end if;
 
-      --  Add the with_clause, if not already in the context of the current
-      --  compilation unit.
+      --  Add the with_clause, if we have not already added an implicit with
+      --  for this unit to the current compilation unit.
 
       declare
          LibUnit : constant Node_Id := Unit (Cunit (U.Unum));
index 393195765a980fbfcb9d70b9d3ae810b420592b6..a03c46552be56e5417ae141ab91ca1abe1f983c6 100644 (file)
@@ -881,12 +881,24 @@ package body Sem_Ch4 is
          S : Entity_Id;
 
       begin
+         --  Do not perform the check while preanalyzing the enclosing context
+         --  because the call is not in its final place. Premature attempts to
+         --  verify the placement lead to bogus errors.
+
+         if In_Spec_Expression then
+            return;
+
          --  The ghost subprogram appears inside an assertion expression
+         --  which is one of the allowed cases.
 
-         if In_Assertion_Expression (N) then
+         elsif In_Assertion_Expression (N) then
             return;
 
+         --  Otherwise see if it inside another ghost subprogram
+
          else
+            --  Loop to climb scopes
+
             S := Current_Scope;
             while Present (S) and then S /= Standard_Standard loop
 
@@ -898,11 +910,14 @@ package body Sem_Ch4 is
 
                S := Scope (S);
             end loop;
-         end if;
 
-         Error_Msg_N
-           ("call to ghost subprogram must appear in assertion expression or "
-            & "another ghost subprogram", N);
+            --  If we fall through the loop it was not within another
+            --  ghost subprogram, so we have bad placement.
+
+            Error_Msg_N
+              ("call to ghost subprogram must appear in assertion expression "
+               & "or another ghost subprogram", N);
+         end if;
       end Check_Ghost_Subprogram_Call;
 
       --------------------------------------------------