]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Fix ancient bug in pragma Suppress (Alignment_Check)
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 23 Oct 2025 17:20:49 +0000 (19:20 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 13 Nov 2025 15:26:58 +0000 (16:26 +0100)
commit40b0325ba5b779e36d24f61b72faf2d0450671c4
treebdf322ec142cf16185dd4fa8e7e890bebdeaff41
parent97fe637c036622b4dd699af71c84902038c4794d
ada: Fix ancient bug in pragma Suppress (Alignment_Check)

The recent change that streamlined the implementation of alignment checks
has uncovered an ancient bug in the implementation of pragma Suppress on
a specific object:

  pragma Suppress (Alignment_Check, A);

The pragma would work only if placed before the address clause:

  A : Integer;
  pragma Suppress (Alignment_Check, A);
  for A'Address use ...

but not if placed (just) after it:

  A : Integer;
  for A'Address use ...
  pragma Suppress (Alignment_Check, A);

which seems unfriendly at best.

gcc/ada/ChangeLog:

* sem_prag.adb (Analyze_Pragma) <Process_Suppress_Unsuppress>: For
Alignment_Check on a specific object with an address clause and no
alignment clause, toggle the Check_Address_Alignment flag present
on the address clause.
gcc/ada/sem_prag.adb