[gcc r15-9804] ada: Fix glitch in handling of Atomic_Components on generic formal type
Eric Botcazou
ebotcazou@gcc.gnu.org
Mon Jun 9 08:28:47 GMT 2025
https://gcc.gnu.org/g:2fd267be72dfb0dbaa422c21888a40e69173defa
commit r15-9804-g2fd267be72dfb0dbaa422c21888a40e69173defa
Author: Piotr Trojanek <trojanek@adacore.com>
Date: Mon Mar 17 12:57:26 2025 +0100
ada: Fix glitch in handling of Atomic_Components on generic formal type
In Ada 2022 aspects Atomic_Components and Volatile_Components can be specified
for a formal array type, but then they need to be set on the base type entity.
Otherwise we get an assertion failure in debug build and wrong legality errors
in production builds.
gcc/ada/ChangeLog:
* sem_prag.adb (Analyze_Pragma): If pragmas apply to a formal array
type, then set the flags on the base type.
Diff:
---
gcc/ada/sem_prag.adb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 621edc7725d8..17805c96fed3 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -14708,7 +14708,9 @@ package body Sem_Prag is
then
-- The flag is set on the base type, or on the object
- if Nkind (D) = N_Full_Type_Declaration then
+ if Nkind (D) in N_Full_Type_Declaration
+ | N_Formal_Type_Declaration
+ then
E := Base_Type (E);
end if;
More information about the Gcc-cvs
mailing list