[Ada] Avoid unnecessary call in preanalysis without freezing
authorPiotr Trojanek <trojanek@adacore.com>
Fri, 28 May 2021 12:54:01 +0000 (14:54 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 9 Jul 2021 12:35:23 +0000 (12:35 +0000)
gcc/ada/

* sem_res.adb (Preanalyze_And_Resolve): Only call
Set_Must_Not_Freeze when it is necessary to restore the previous
value.

gcc/ada/sem_res.adb

index 26e4a07..e2c069c 100644 (file)
@@ -1886,9 +1886,9 @@ package body Sem_Res is
 
       Expander_Mode_Restore;
       Full_Analysis := Save_Full_Analysis;
-      Set_Must_Not_Freeze (N, Save_Must_Not_Freeze);
 
       if not With_Freezing then
+         Set_Must_Not_Freeze (N, Save_Must_Not_Freeze);
          Inside_Preanalysis_Without_Freezing :=
            Inside_Preanalysis_Without_Freezing - 1;
       end if;