[gcc r16-9045] ada: Reject misalignment of objects with address clause
Eric Botcazou
ebotcazou@gcc.gnu.org
Tue Jun 2 22:25:18 GMT 2026
https://gcc.gnu.org/g:b014177b410fe183e7ff2d05bd436c5d7a4a3916
commit r16-9045-gb014177b410fe183e7ff2d05bd436c5d7a4a3916
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Thu Apr 30 13:08:17 2026 +0200
ada: Reject misalignment of objects with address clause
Misaligned objects are meant to be rejected universally by the compiler.
gcc/ada/ChangeLog:
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Validate
a known alignment on the object even if there is an address clause.
Diff:
---
gcc/ada/gcc-interface/decl.cc | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 6510ac794594..f9f87b1362e1 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -814,12 +814,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
}
/* If an alignment is specified, use it if valid. Note that exceptions
- are objects but don't have an alignment and there is also no point in
- setting it for an address clause, since the final type of the object
- will be a reference type. */
- if (Known_Alignment (gnat_entity)
- && kind != E_Exception
- && No (Address_Clause (gnat_entity)))
+ are objects but don't have an alignment. */
+ if (Known_Alignment (gnat_entity) && kind != E_Exception)
align = validate_alignment (Alignment (gnat_entity), gnat_entity,
TYPE_ALIGN (gnu_type));
More information about the Gcc-cvs
mailing list