aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2019-12-16 10:34:47 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-12-16 10:34:47 +0000
commit1dcdd961c5cdce6e850ff20b1954919972553920 (patch)
tree9b56814f8542a8ee0d5a33de55d7997f550d97e9
parentc85dda723615051018ea8e19e5f0431e5ffdae55 (diff)
downloadgcc-1dcdd961c5cdce6e850ff20b1954919972553920.zip
gcc-1dcdd961c5cdce6e850ff20b1954919972553920.tar.gz
gcc-1dcdd961c5cdce6e850ff20b1954919972553920.tar.bz2
[Ada] Remove new strict-alignment check added by AI12-0001
2019-12-16 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * freeze.adb (Check_Strict_Alignment): Remove new check on Has_Aliased_Components for array types. From-SVN: r279433
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/freeze.adb30
2 files changed, 19 insertions, 16 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5533c1c..8f5c089 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2019-12-16 Eric Botcazou <ebotcazou@adacore.com>
+
+ * freeze.adb (Check_Strict_Alignment): Remove new check on
+ Has_Aliased_Components for array types.
+
2019-12-16 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb (Try_Container_Indexing): In the case of a derived
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 36cf63c..0312ca7 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -1614,24 +1614,22 @@ package body Freeze is
Set_Strict_Alignment (E);
elsif Is_Array_Type (E) then
- if Has_Aliased_Components (E)
- or else Strict_Alignment (Component_Type (E))
- then
- Set_Strict_Alignment (E);
- end if;
+ Set_Strict_Alignment (E, Strict_Alignment (Component_Type (E)));
- elsif Is_Record_Type (E) then
- -- ??? If the type has convention C_Pass_By_Copy, we consider
- -- that it may be packed even if it contains aliased parts.
- -- Such types are very unlikely to be misaligned in practice
- -- and this makes the compiler accept dubious representation
- -- clauses used in Florist on types containing arrays with
- -- aliased components.
-
- if C_Pass_By_Copy (E) then
- return;
- end if;
+ -- ??? AI12-001: Any component of a packed type that contains an
+ -- aliased part must be aligned according to the alignment of its
+ -- subtype (RM 13.2(7)). This means that the following test:
+
+ -- if Has_Aliased_Components (E) then
+ -- Set_Strict_Alignment (E);
+ -- end if;
+ -- should be implemented here. Unfortunately it would break Florist,
+ -- which has the bad habit of overaligning all the types it declares
+ -- on 32-bit platforms. Other legacy codebases could also be affected
+ -- because this check has historically been missing in GNAT.
+
+ elsif Is_Record_Type (E) then
Comp := First_Component (E);
while Present (Comp) loop
if not Is_Type (Comp)