[Ada] Suppress_Initialization not respected for private subtypes

Pierre-Marie de Rodat derodat@adacore.com
Mon Aug 12 09:10:00 GMT 2019


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).

Tested on x86_64-pc-linux-gnu, committed on trunk

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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 1075 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190812/8863add2/attachment.bin>


More information about the Gcc-patches mailing list