[Ada] Spurious warning on object declaration with address clause
commitf9e9ab637986a24d7cd8538ff5bd68e599ce6e12
authorEd Schonberg <schonberg@adacore.com>
Mon, 21 May 2018 14:52:36 +0000 (21 14:52 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 21 May 2018 14:52:36 +0000 (21 14:52 +0000)
tree304c4728abcc8b80f44144ef4d6cf9aa929647bf
parentaf5d8cb0f6bbb33cc5f4aae125b7c34a4f59a8cb
[Ada] Spurious warning on object declaration with address clause

The compiler warns on an object declaration with default initialization
and an address clause, to indicate that the overlay implied by the address
clause might affect a value elsewhere. The warning is suppressed if the type
carries the Suppress_Initialization aspect. With this patch the compiler
also inhibits the warning if the aspect is specified for the object itself.

2018-05-21  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

* freeze.adb (Warn_Overlay): Do not emit a wawrning on an object
declaration with an explicit address clause and a type with default
initialization, if the declaration carries an aspect
Suppress_Initialization.

gcc/testsuite/

* gnat.dg/suppress_initialization.adb,
gnat.dg/suppress_initialization_pkg.ads: New testcase.

From-SVN: r260471
gcc/ada/ChangeLog
gcc/ada/freeze.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/suppress_initialization.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/suppress_initialization_pkg.ads [new file with mode: 0644]