[Ada] Suppress_Initialization not respected for private subtypes
authorGary Dismukes <dismukes@adacore.com>
Mon, 12 Aug 2019 08:59:58 +0000 (08:59 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 12 Aug 2019 08:59:58 +0000 (08:59 +0000)
commit651c9c1e4b1bd2369ced718599ad1ac370aa37cd
tree2f0b427dca7000c4abffd359d1f8ebedc874f15f
parent9dfc6c55085848a60d19825bdc0b7d345bdf8603
[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
gcc/ada/ChangeLog
gcc/ada/sem_prag.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/suppress_initialization2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/suppress_initialization2.ads [new file with mode: 0644]