From 9fc154c8cc66d8ab7baca7d80573ecd0f64c3a10 Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Fri, 5 Jul 2013 10:52:13 +0000 Subject: [PATCH] sem_ch13.adb (Analyze_Aspect_Specifications): For pre/postconditions copy the expression to the generated pragma... 2013-07-05 Ed Schonberg * sem_ch13.adb (Analyze_Aspect_Specifications): For pre/postconditions copy the expression to the generated pragma, to avoid sharing between the original aspect and the pragma node, because in ASIS_Mode both will be independently analyzed. From-SVN: r200710 --- gcc/ada/ChangeLog | 7 +++++++ gcc/ada/sem_ch13.adb | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 24b3fd2..6bec4e8 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,12 @@ 2013-07-05 Ed Schonberg + * sem_ch13.adb (Analyze_Aspect_Specifications): For + pre/postconditions copy the expression to the generated pragma, + to avoid sharing between the original aspect and the pragma node, + because in ASIS_Mode both will be independently analyzed. + +2013-07-05 Ed Schonberg + * exp_ch3.adb (Build_Variant_Record_Equality): Add pairs of formals for each discriminant of an unchecked union. (Make_Eq_Case): Suprogram accepts a list of discriminants. Nested diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 1496912..0eb18f1 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -1799,13 +1799,16 @@ package body Sem_Ch13 is end loop; end if; - -- Build the precondition/postcondition pragma + -- 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. Make_Aitem_Pragma (Pragma_Argument_Associations => New_List ( Make_Pragma_Argument_Association (Eloc, Chars => Name_Check, - Expression => Relocate_Node (Expr))), + Expression => New_Copy_Tree (Expr))), Pragma_Name => Pname); -- Add message unless exception messages are suppressed -- 2.7.4