[Ada] Fix spurious alignment warning on simple address clause
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 18 Sep 2019 08:33:44 +0000 (08:33 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Wed, 18 Sep 2019 08:33:44 +0000 (08:33 +0000)
commit5c13a04e0dcb6e6c07708dc6796968ee89b4560b
treedae5541eb31bca41017d94b7d91849322b24bb50
parent1784b1eb1f22a802cf7e2f3529fa83a40bce1b20
[Ada] Fix spurious alignment warning on simple address clause

This eliminates a spurious alignment warning given by the compiler on an
address clause when the No_Exception_Propagation restriction is in
effect and the -gnatw.x switch is used. In this configuration the
address clauses whose expression is itself of the form X'Address would
not be sufficiently analyzed and, therefore, the compiler might give
false positive warnings.

2019-09-18  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* checks.ads (Alignment_Warnings_Record): Add P component.
* checks.adb (Apply_Address_Clause_Check): Be prepared to kill
the warning also if the clause is of the form X'Address.
(Validate_Alignment_Check_Warning): Kill the warning if the
clause is of the form X'Address and the alignment of X is
compatible.

gcc/testsuite/

* gnat.dg/warn31.adb, gnat.dg/warn31.ads: New testcase.

From-SVN: r275865
gcc/ada/ChangeLog
gcc/ada/checks.adb
gcc/ada/checks.ads
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/warn31.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/warn31.ads [new file with mode: 0644]