diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2025-03-17 12:57:26 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2025-06-09 10:23:34 +0200 |
commit | 2fd267be72dfb0dbaa422c21888a40e69173defa (patch) | |
tree | 49d7ca7716d3069a68026ecd33324fb6984e1f2a | |
parent | f59c4d4a6a30c655afb53236eee2bda9e2d2cbb2 (diff) | |
download | gcc-2fd267be72dfb0dbaa422c21888a40e69173defa.zip gcc-2fd267be72dfb0dbaa422c21888a40e69173defa.tar.gz gcc-2fd267be72dfb0dbaa422c21888a40e69173defa.tar.bz2 |
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.
-rw-r--r-- | gcc/ada/sem_prag.adb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 621edc7..17805c9 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; |