aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2018-05-25 09:03:34 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-25 09:03:34 +0000
commit1f233db3745890d8c9bed07f44a8b078bb2a0ee9 (patch)
tree53544bddf4d875bd0013449de2f154126f25f15b /gcc
parent0d0cd28165d05981eadc966224dca77b87111b62 (diff)
downloadgcc-1f233db3745890d8c9bed07f44a8b078bb2a0ee9.zip
gcc-1f233db3745890d8c9bed07f44a8b078bb2a0ee9.tar.gz
gcc-1f233db3745890d8c9bed07f44a8b078bb2a0ee9.tar.bz2
[Ada] Fix handling of Loop_Entry for CodePeer/SPARK
When the applicable Assertion_Policy is Ignore for a pragma containing an occurrence of attribute Loop_Entry, CodePeer and SPARK should still be able to analyze the corresponding pragma. GNAT frontend was wrongly translating X'Loop_Entry as X in the AST, as a side-effect of an optimization only valid for compilation and not for static analysis. This has no effect on compilation. 2018-05-25 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_prag.adb (Check_Applicable_Policy): Deal specially with CodePeer and GNATprove modes when applicable policy is Ignore. From-SVN: r260722
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/sem_prag.adb19
2 files changed, 21 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 838c445..a6fb325 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2018-05-25 Yannick Moy <moy@adacore.com>
+
+ * sem_prag.adb (Check_Applicable_Policy): Deal specially with CodePeer
+ and GNATprove modes when applicable policy is Ignore.
+
2018-05-25 Eric Botcazou <ebotcazou@adacore.com>
* freeze.adb (Freeze_Enumeration_Type): Do not give integer size to a
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 85a064d..eb6a018 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -28542,8 +28542,20 @@ package body Sem_Prag is
when Name_Ignore
| Name_Off
=>
- Set_Is_Ignored (N, True);
- Set_Is_Checked (N, False);
+ -- In CodePeer mode and GNATprove mode, we need to
+ -- consider all assertions, unless they are
+ -- disabled. Force Is_Checked on ignored assertions, in
+ -- particular because transformations of the AST may
+ -- depend on assertions being checked (e.g. the
+ -- translation of attribute 'Loop_Entry).
+
+ if CodePeer_Mode or GNATprove_Mode then
+ Set_Is_Checked (N, True);
+ Set_Is_Ignored (N, False);
+ else
+ Set_Is_Ignored (N, True);
+ Set_Is_Checked (N, False);
+ end if;
when Name_Check
| Name_On
@@ -28573,7 +28585,8 @@ package body Sem_Prag is
-- If there are no specific entries that matched, then we let the
-- setting of assertions govern. Note that this provides the needed
-- compatibility with the RM for the cases of assertion, invariant,
- -- precondition, predicate, and postcondition.
+ -- precondition, predicate, and postcondition. Note also that
+ -- Assertions_Enabled is forced in CodePeer mode and GNATprove mode.
if Assertions_Enabled then
Set_Is_Checked (N, True);