[Ada] Improve handling of aggregates in Side_Effect_Free
authorArnaud Charlet <charlet@adacore.com>
Mon, 2 Mar 2020 08:58:02 +0000 (03:58 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Tue, 9 Jun 2020 08:09:05 +0000 (04:09 -0400)
2020-06-09  Arnaud Charlet  <charlet@adacore.com>

gcc/ada/

* exp_util.adb (Side_Effect_Free): Improve handling of
N_Aggregate.

gcc/ada/exp_util.adb

index 87abe9a..91d5c81 100644 (file)
@@ -13357,6 +13357,12 @@ package body Exp_Util is
          =>
             return True;
 
+         --  An aggregate is side effect free if all its values are compile
+         --  time known.
+
+         when N_Aggregate =>
+            return Compile_Time_Known_Aggregate (N);
+
          --  We consider that anything else has side effects. This is a bit
          --  crude, but we are pretty close for most common cases, and we
          --  are certainly correct (i.e. we never return True when the