aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2019-08-12 08:59:58 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-12 08:59:58 +0000
commit651c9c1e4b1bd2369ced718599ad1ac370aa37cd (patch)
tree2f0b427dca7000c4abffd359d1f8ebedc874f15f /gcc/ada
parent9dfc6c55085848a60d19825bdc0b7d345bdf8603 (diff)
downloadgcc-651c9c1e4b1bd2369ced718599ad1ac370aa37cd.zip
gcc-651c9c1e4b1bd2369ced718599ad1ac370aa37cd.tar.gz
gcc-651c9c1e4b1bd2369ced718599ad1ac370aa37cd.tar.bz2
[Ada] Suppress_Initialization not respected for private subtypes
The compiler fails to suppress initialization on a variable of a subtype of a private type (such as System.Address) even though the subtype has aspect Suppress_Initialization. This can lead to errors on object declarations specified with Thread_Local_Storage when Initialize_Scalars is applied (as well as leading to default initialization when it shouldn't). 2019-08-12 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * sem_prag.adb (Analyze_Pragma, Pragma_Suppress_Initialization): For private types, set the Suppress_Initialization flag on the Full_View of the entity rather than the entity's base type. gcc/testsuite/ * gnat.dg/suppress_initialization2.adb, gnat.dg/suppress_initialization2.ads: New testcase. From-SVN: r274293
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog6
-rw-r--r--gcc/ada/sem_prag.adb2
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 78d78cc..4e76edf 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,9 @@
+2019-08-12 Gary Dismukes <dismukes@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma, Pragma_Suppress_Initialization):
+ For private types, set the Suppress_Initialization flag on the
+ Full_View of the entity rather than the entity's base type.
+
2019-08-12 Yannick Moy <moy@adacore.com>
* aspects.adb, aspects.ads (Aspect_No_Caching): New aspect.
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 599ac4c..30b6088 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -24169,7 +24169,7 @@ package body Sem_Prag is
Error_Pragma_Arg
("argument of pragma% cannot be an incomplete type", Arg1);
else
- Set_Suppress_Initialization (Full_View (Base_Type (E)));
+ Set_Suppress_Initialization (Full_View (E));
end if;
-- For first subtype, set flag on base type