aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2013-07-08 07:39:55 +0000
committerArnaud Charlet <charlet@gcc.gnu.org>2013-07-08 09:39:55 +0200
commit1bc331122b9f6a30124d1deb32a7af5eef006a00 (patch)
tree241352b549f57fad231ce14d95c5330f965a20ab /gcc
parent930b700ba28617ea074b0f4e54d3b00b8d9be0a2 (diff)
downloadgcc-1bc331122b9f6a30124d1deb32a7af5eef006a00.zip
gcc-1bc331122b9f6a30124d1deb32a7af5eef006a00.tar.gz
gcc-1bc331122b9f6a30124d1deb32a7af5eef006a00.tar.bz2
sem_prag.adb (Analyze_PPC_In_Decl_Part): In ASIS mode...
2013-07-08 Ed Schonberg <schonberg@adacore.com> * sem_prag.adb (Analyze_PPC_In_Decl_Part): In ASIS mode, pre-analyze only the original expression attached to the source aspect, not the relocated expression of the pragma, to prevent malformed trees in ASIS mode. * sem_ch13.adb (Analyze_Aspect_Specifications): Revert previous patch: the expression in the aspect for pre/post must be relocated to the pragma for proper analysis. From-SVN: r200752
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog10
-rw-r--r--gcc/ada/sem_ch13.adb7
-rw-r--r--gcc/ada/sem_prag.adb10
3 files changed, 18 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5d222e7..a6a808f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,13 @@
+2013-07-08 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb (Analyze_PPC_In_Decl_Part): In ASIS mode,
+ pre-analyze only the original expression attached to the source
+ aspect, not the relocated expression of the pragma, to prevent
+ malformed trees in ASIS mode.
+ * sem_ch13.adb (Analyze_Aspect_Specifications): Revert previous
+ patch: the expression in the aspect for pre/post must be relocated
+ to the pragma for proper analysis.
+
2013-07-05 Hristian Kirtchev <kirtchev@adacore.com>
* aspects.adb: Add an entry for SPARK_Mode in table Canonical_Aspect.
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 5378fa3..2cb3d29 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -1809,16 +1809,13 @@ package body Sem_Ch13 is
end loop;
end if;
- -- Build the precondition/postcondition pragma. We copy
- -- the expression to avoid sharing between the original
- -- aspect and the pragma node, because in ASIS_Mode both
- -- will be independently analyzed.
+ -- Build the precondition/postcondition pragma.
Make_Aitem_Pragma
(Pragma_Argument_Associations => New_List (
Make_Pragma_Argument_Association (Eloc,
Chars => Name_Check,
- Expression => New_Copy_Tree (Expr))),
+ Expression => Relocate_Node (Expr))),
Pragma_Name => Pname);
-- Add message unless exception messages are suppressed
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 36c3d7f..16bccac 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -1718,14 +1718,16 @@ package body Sem_Prag is
-- Preanalyze the boolean expression, we treat this as a spec expression
-- (i.e. similar to a default expression).
- Preanalyze_Assert_Expression (Get_Pragma_Arg (Arg1), Standard_Boolean);
-
- -- In ASIS mode, for a pragma generated from a source aspect, also
- -- analyze the original aspect expression.
+ -- In ASIS mode, for a pragma generated from a source aspect, analyze
+ -- directly the the original aspect expression, which is shared with
+ -- the generated pragma.
if ASIS_Mode and then Present (Corresponding_Aspect (N)) then
Preanalyze_Assert_Expression
(Expression (Corresponding_Aspect (N)), Standard_Boolean);
+ else
+ Preanalyze_Assert_Expression
+ (Get_Pragma_Arg (Arg1), Standard_Boolean);
end if;
-- For a class-wide condition, a reference to a controlling formal must