diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2019-09-18 08:33:44 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-09-18 08:33:44 +0000 |
commit | 5c13a04e0dcb6e6c07708dc6796968ee89b4560b (patch) | |
tree | dae5541eb31bca41017d94b7d91849322b24bb50 /gcc/ada/checks.ads | |
parent | 1784b1eb1f22a802cf7e2f3529fa83a40bce1b20 (diff) | |
download | gcc-5c13a04e0dcb6e6c07708dc6796968ee89b4560b.zip gcc-5c13a04e0dcb6e6c07708dc6796968ee89b4560b.tar.gz gcc-5c13a04e0dcb6e6c07708dc6796968ee89b4560b.tar.bz2 |
[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
Diffstat (limited to 'gcc/ada/checks.ads')
-rw-r--r-- | gcc/ada/checks.ads | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/checks.ads b/gcc/ada/checks.ads index 9bf2908..a1538a3 100644 --- a/gcc/ada/checks.ads +++ b/gcc/ada/checks.ads @@ -90,7 +90,7 @@ package Checks is -- When we have address clauses, there is an issue of whether the address -- specified is appropriate to the alignment. In the general case where the -- address is dynamic, we generate a check and a possible warning (this - -- warning occurs for example if we have a restricted run time with the + -- warning occurs for example if we have a restricted runtime with the -- restriction No_Exception_Propagation). We also issue this warning in -- the case where the address is static, but we don't know the alignment -- at the time we process the address clause. In such a case, we issue the @@ -98,7 +98,7 @@ package Checks is -- annotated the actual alignment chosen) that the warning was not needed. -- To deal with deleting these potentially annoying warnings, we save the - -- warning information in a table, and then delete the waranings in the + -- warning information in a table, and then delete the warnings in the -- post compilation validation stage if we can tell that the check would -- never fail (in general the back end will also optimize away the check -- in such cases). @@ -113,6 +113,9 @@ package Checks is -- Compile time known value of address clause for which the alignment -- is to be checked once we know the alignment. + P : Node_Id; + -- Prefix of address clause when it is of the form X'Address + W : Error_Msg_Id; -- Id of warning message we might delete end record; |