diff mbox series

[Ada] Fix bogus error for bit-packed array with volatile component

Message ID 20201021072333.GA73607@adacore.com
State New
Headers show
Series [Ada] Fix bogus error for bit-packed array with volatile component | expand

Commit Message

Pierre-Marie de Rodat Oct. 21, 2020, 7:23 a.m. UTC
This fixes a bogus error recently introduced in the compiler for a
bit-packed array component in a record type with Volatile_Components
aspect on the array definition.  The array type should not be deemed
requiring strict alignment, although it is a by-reference type.

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

gcc/ada/

	* freeze.adb (Check_Strict_Alignment): Do not set the flag for
	a bit-packed array type, even if it is a by-reference type.
diff mbox series

Patch

diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -1609,7 +1609,10 @@  package body Freeze is
       Comp  : Entity_Id;
 
    begin
-      if Is_By_Reference_Type (E) then
+      --  Bit-packed array types do not require strict alignment, even if they
+      --  are by-reference types, because they are accessed in a special way.
+
+      if Is_By_Reference_Type (E) and then not Is_Bit_Packed_Array (E) then
          Set_Strict_Alignment (E);
 
       elsif Is_Array_Type (E) then