[Ada] Do not generate extra copies inside initialization procedures
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 4 Jun 2020 07:56:02 +0000 (09:56 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 15 Jul 2020 13:42:54 +0000 (09:42 -0400)
gcc/ada/

* exp_ch6.adb (Requires_Atomic_Or_Volatile_Copy): Return false
inside an initialization procedure.

gcc/ada/exp_ch6.adb

index 5bc8bf5..41ed764 100644 (file)
@@ -2196,6 +2196,13 @@ package body Exp_Ch6 is
             return False;
          end if;
 
+         --  There is no requirement inside initialization procedures and this
+         --  would generate copies for atomic or volatile composite components.
+
+         if Inside_Init_Proc then
+            return False;
+         end if;
+
          --  Check for atomicity mismatch
 
          if Is_Atomic_Object (Actual) and then not Is_Atomic (E_Formal)