aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2018-05-25 09:02:58 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-25 09:02:58 +0000
commit56ce7e4aa9cfbeb2df1a02a4ae899faaeedb2ab4 (patch)
tree2d1a4a1d495b556e5f224272e2815dddbd291f6a /gcc
parent5c737a562b83361afa576c9aba61a788cf354e62 (diff)
downloadgcc-56ce7e4aa9cfbeb2df1a02a4ae899faaeedb2ab4.zip
gcc-56ce7e4aa9cfbeb2df1a02a4ae899faaeedb2ab4.tar.gz
gcc-56ce7e4aa9cfbeb2df1a02a4ae899faaeedb2ab4.tar.bz2
[Ada] Detect misplaced assertions between loop invariants
Loop invariants and loop variants should all be colocated, as defined in SPARK RM 5.5.3(8). The code checking that rule was incorrectly accepting pragma Assert between two loop invariants. Now fixed. 2018-05-25 Yannick Moy <moy@adacore.com> gcc/ada/ * sem_prag.adb (Check_Grouping): Modify test to ignore statements and declarations not coming from source. From-SVN: r260715
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/sem_prag.adb9
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 37dce8b..8fd4052 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_Grouping): Modify test to ignore statements and
+ declarations not coming from source.
+
2018-05-25 Fedor Rybin <frybin@adacore.com>
* doc/gnat_ugn/gnat_utility_programs.rst: Document new switch
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index cd46404..85a064d 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -5979,9 +5979,14 @@ package body Sem_Prag is
Prag := Stmt;
-- Skip declarations and statements generated by
- -- the compiler during expansion.
+ -- the compiler during expansion. Note that some
+ -- source statements (e.g. pragma Assert) may have
+ -- been transformed so that they do not appear as
+ -- coming from source anymore, so we instead look
+ -- at their Original_Node.
- elsif not Comes_From_Source (Stmt) then
+ elsif not Comes_From_Source (Original_Node (Stmt))
+ then
null;
-- A non-pragma is separating the group from the