During Expand, prevent the clearing of the Analyzed flag if it has
already been set by Fold_Ureal.

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

gcc/ada/

        * expander.adb (Expand): Skip clearing of Analyzed flag if
        already set for N_Real_Literal.
diff --git a/gcc/ada/expander.adb b/gcc/ada/expander.adb
--- a/gcc/ada/expander.adb
+++ b/gcc/ada/expander.adb
@@ -49,6 +49,7 @@ with Sem_Ch8;        use Sem_Ch8;
 with Sem_Util;       use Sem_Util;
 with Sinfo;          use Sinfo;
 with Sinfo.Nodes;    use Sinfo.Nodes;
+with Stand;          use Stand;
 with Table;
 
 package body Expander is
@@ -152,7 +153,19 @@ package body Expander is
       --  not take place. This prevents cascaded errors due to stack mismatch.
 
       elsif not Expander_Active then
-         Set_Analyzed (N, Full_Analysis);
+
+         --  Do not clear the Analyzed flag if it has been set on purpose
+         --  during preanalysis in Fold_Ureal. In that case, the Etype field
+         --  in N_Real_Literal will be set to something different than
+         --  Universal_Real.
+
+         if Full_Analysis
+           or else not (Nkind (N) = N_Real_Literal
+                          and then Present (Etype (N))
+                          and then Etype (N) /= Universal_Real)
+         then
+            Set_Analyzed (N, Full_Analysis);
+         end if;
 
          if Serious_Errors_Detected > 0 and then Scope_Is_Transient then
             Scope_Stack.Table


Reply via email to