[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 29 Oct 2012 10:02:16 +0000 (11:02 +0100)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 29 Oct 2012 10:02:16 +0000 (11:02 +0100)
2012-10-29  Steve Baird  <baird@adacore.com>

* sem_ch13.adb (Analyze_Attribute_Definition_Clause): If CodePeer_Mode
= True and we detect that an Address specification is used to overlay
another object, do not set that object's Treat_As_Volatile flag.

2012-10-29  Ed Schonberg  <schonberg@adacore.com>

* sem_ch3.adb (Constant_Redeclaration): If the type of a
deferred constant has invariants, generate invariant call on
the initial value.

From-SVN: r192917

gcc/ada/ChangeLog
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb

index ef0c3209571d3c0d87298db73ac8d16f9fb68bf7..ecd16a2f91ed7e2e123b27e420037c47569895a4 100644 (file)
@@ -1,3 +1,15 @@
+2012-10-29  Steve Baird  <baird@adacore.com>
+
+       * sem_ch13.adb (Analyze_Attribute_Definition_Clause): If CodePeer_Mode
+       = True and we detect that an Address specification is used to overlay
+       another object, do not set that object's Treat_As_Volatile flag.
+
+2012-10-29  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch3.adb (Constant_Redeclaration): If the type of a
+       deferred constant has invariants, generate invariant call on
+       the initial value.
+
 2012-10-29  Bob Duff  <duff@adacore.com>
 
        * sem_ch13.adb (Replace_Type_Reference): Use correct sloc for
index 94fd6a6d816698602d092cfc4f2dac466e967962..e67026dcb63a71806a5a6f5233b5646407ecfbf6 100644 (file)
@@ -2708,7 +2708,21 @@ package body Sem_Ch13 is
                   if Present (O_Ent)
                     and then Is_Object (O_Ent)
                     and then not Off
+
+                    --  The following test is an expedient solution to what
+                    --  is really a problem in CodePeer. Suppressing the
+                    --  Set_Treat_As_Volatile call here prevents later
+                    --  generation (in some cases) of trees that CodePeer
+                    --  should, but currently does not, handle correctly.
+                    --  This test should probably be removed when CodePeer
+                    --  is improved, just because we want the tree CodePeer
+                    --  analyzes to match the tree for which we generate code
+                    --  as closely as is practical. ???
+
+                    and then not CodePeer_Mode
                   then
+                     --  ??? O_Ent might not be in current unit
+
                      Set_Treat_As_Volatile (O_Ent);
                   end if;
 
index 7dd808c0d0d62f5f1b20b4cdc589d4460dc9e348..818bfd083cd1ae5c16d8b8a9eebe6cabf66dd23d 100644 (file)
@@ -10656,6 +10656,18 @@ package body Sem_Ch3 is
          then
             Check_Recursive_Declaration (Designated_Type (T));
          end if;
+
+         --  A deferred constant is a visible entity. If type has invariants,
+         --  verify that the initial value satisfies them.
+
+         if Expander_Active and then Has_Invariants (T) then
+            declare
+               Call : constant Node_Id :=
+                 Make_Invariant_Call (New_Occurrence_Of (Prev, Sloc (N)));
+            begin
+               Insert_After (N, Call);
+            end;
+         end if;
       end if;
    end Constant_Redeclaration;