[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 5 Aug 2010 09:14:19 +0000 (11:14 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 5 Aug 2010 09:14:19 +0000 (11:14 +0200)
2010-08-05  Thomas Quinot  <quinot@adacore.com>

* sem_ch6.adb, gnat1drv.adb, exp_ch6.adb, sem_eval.adb: Minor
reformatting.

2010-08-05  Steve Baird  <baird@adacore.com>

* exp_util.adb (Remove_Side_Effects): An access value which designates
a volatile object of a nonvolatile type is prohibited.
Do not call Make_Reference to construct a reference to such an object.

From-SVN: r162905

gcc/ada/ChangeLog
gcc/ada/exp_ch6.adb
gcc/ada/exp_util.adb
gcc/ada/gnat1drv.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_eval.adb

index 9958ead770407b391915e2bf632b2ad97a25f85b..6e188f0caabe596880610f4b8ca65ed003e69377 100644 (file)
@@ -1,3 +1,14 @@
+2010-08-05  Thomas Quinot  <quinot@adacore.com>
+
+       * sem_ch6.adb, gnat1drv.adb, exp_ch6.adb, sem_eval.adb: Minor
+       reformatting.
+
+2010-08-05  Steve Baird  <baird@adacore.com>
+
+       * exp_util.adb (Remove_Side_Effects): An access value which designates
+       a volatile object of a nonvolatile type is prohibited.
+       Do not call Make_Reference to construct a reference to such an object.
+
 2010-08-05  Robert Dewar  <dewar@adacore.com>
 
        * a-suezse.adb, a-suezse.ads, a-suezen.adb, a-suezen.ads: Removed.
index 9ddb278417c23f07dea5752a337a622cf0f2adc3..11a2161e99d1f8232583194a0b3cd52136aa51a9 100644 (file)
@@ -3713,9 +3713,7 @@ package body Exp_Ch6 is
 
          Set_Name (N, New_Occurrence_Of (Orig_Bod, Loc));
 
-         if Present (Alias (Orig_Bod))
-           or else Is_Inlined (Orig_Bod)
-         then
+         if Present (Alias (Orig_Bod)) or else Is_Inlined (Orig_Bod) then
             Expand_Call (N);
          end if;
 
index 133a767f0562d8e33ff6faa64222fa4692e99ee4..0c0377b9ec2369aefa224a2a2bdb990e10b0c655 100644 (file)
@@ -4799,12 +4799,17 @@ package body Exp_Util is
          end if;
 
       --  For expressions that denote objects, we can use a renaming scheme.
-      --  We skip using this if we have a volatile reference and we do not
-      --  have Name_Req set true (see comments above for Side_Effect_Free).
+      --  This is needed for correctness in the case of a volatile object
+      --  of a non-volatile type because the Make_Reference call of the
+      --  "default" approach would generate an illegal access value (an access
+      --  value cannot designate such an object - see Analyze_Reference).
+      --  We skip using this scheme if we have an object of a volatile type
+      --  and we do not have Name_Req set true (see comments above for
+      --  Side_Effect_Free).
 
       elsif Is_Object_Reference (Exp)
         and then Nkind (Exp) /= N_Function_Call
-        and then (Name_Req or else not Is_Volatile_Reference (Exp))
+        and then (Name_Req or else not Treat_As_Volatile (Exp_Type))
       then
          Def_Id := Make_Temporary (Loc, 'R', Exp);
 
index d3d15ccc3b1531312ea1d634a75d0b0ffa70e582..c514570d91b4f7e7fd6786fded631d07e577a79c 100644 (file)
@@ -441,20 +441,19 @@ procedure Gnat1drv is
          Fname := Get_File_Name (Sname, Subunit => False);
          Src_Ind := Load_Source_File (Fname);
 
-         --  Case where body is present and it is not a subunit. Exclude
-         --  the subunit case, because it has nothing to do with the
-         --  package we are compiling. It is illegal for a child unit and a
-         --  subunit with the same expanded name (RM 10.2(9)) to appear
-         --  together in a partition, but there is nothing to stop a
-         --  compilation environment from having both, and the test here
-         --  simply allows that. If there is an attempt to include both in
-         --  a partition, this is diagnosed at bind time. In Ada 83 mode
-         --  this is not a warning case.
-
-         --  Note: if weird file names are being used, we can have
-         --  situation where the file name that supposedly contains body,
-         --  in fact contains a spec, or we can't tell what it contains.
-         --  Skip the error message in these cases.
+         --  Case where body is present and it is not a subunit. Exclude the
+         --  subunit case, because it has nothing to do with the package we are
+         --  compiling. It is illegal for a child unit and a subunit with the
+         --  same expanded name (RM 10.2(9)) to appear together in a partition,
+         --  but there is nothing to stop a compilation environment from having
+         --  both, and the test here simply allows that. If there is an attempt
+         --  to include both in a partition, this is diagnosed at bind time. In
+         --  Ada 83 mode this is not a warning case.
+
+         --  Note: if weird file names are being used, we can have a situation
+         --  where the file name that supposedly contains body in fact contains
+         --  a spec, or we can't tell what it contains. Skip the error message
+         --  in these cases.
 
          --  Also ignore body that is nothing but pragma No_Body; (that's the
          --  whole point of this pragma, to be used this way and to cause the
@@ -635,8 +634,7 @@ begin
          if S = No_Source_File then
             Write_Line
               ("fatal error, run-time library not installed correctly");
-            Write_Line
-              ("cannot locate file system.ads");
+            Write_Line ("cannot locate file system.ads");
             raise Unrecoverable_Error;
 
          --  Remember source index of system.ads (which was read successfully)
@@ -778,18 +776,14 @@ begin
       --  subunits. Note that we always generate code for all generic units (a
       --  change from some previous versions of GNAT).
 
-      elsif Main_Kind = N_Subprogram_Body
-        and then not Subunits_Missing
-      then
+      elsif Main_Kind = N_Subprogram_Body and then not Subunits_Missing then
          Back_End_Mode := Generate_Object;
 
       --  We can generate code for a package body unless there are subunits
       --  missing (note that we always generate code for generic units, which
       --  is a change from some earlier versions of GNAT).
 
-      elsif Main_Kind = N_Package_Body
-        and then not Subunits_Missing
-      then
+      elsif Main_Kind = N_Package_Body and then not Subunits_Missing then
          Back_End_Mode := Generate_Object;
 
       --  We can generate code for a package declaration or a subprogram
@@ -903,8 +897,8 @@ begin
          Exit_Program (E_No_Code);
       end if;
 
-      --  In -gnatc mode, we only do annotation if -gnatt or -gnatR is also
-      --  set as indicated by Back_Annotate_Rep_Info being set to True.
+      --  In -gnatc mode, we only do annotation if -gnatt or -gnatR is also set
+      --  as indicated by Back_Annotate_Rep_Info being set to True.
 
       --  We don't call for annotations on a subunit, because to process those
       --  the back-end requires that the parent(s) be properly compiled.
@@ -912,8 +906,8 @@ begin
       --  Annotation is suppressed for targets where front-end layout is
       --  enabled, because the front end determines representations.
 
-      --  Annotation is also suppressed in the case of compiling for
-      --  a VM, since representations are largely symbolic there.
+      --  Annotation is also suppressed in the case of compiling for a VM,
+      --  since representations are largely symbolic there.
 
       if Back_End_Mode = Declarations_Only
         and then (not (Back_Annotate_Rep_Info or Generate_SCIL)
@@ -1011,11 +1005,10 @@ begin
 
       Write_ALI (Object => (Back_End_Mode = Generate_Object));
 
-      --  Generate the ASIS tree after writing the ALI file, since in ASIS
-      --  mode, Write_ALI may in fact result in further tree decoration from
-      --  the original tree file. Note that we dump the tree just before
-      --  generating it, so that the dump will exactly reflect what is written
-      --  out.
+      --  Generate ASIS tree after writing the ALI file, since in ASIS mode,
+      --  Write_ALI may in fact result in further tree decoration from the
+      --  original tree file. Note that we dump the tree just before generating
+      --  it, so that the dump will exactly reflect what is written out.
 
       Treepr.Tree_Dump;
       Tree_Gen;
index cbdaf68180f58555855099719948731e78b08fac..cfd88289fb747a5a46ccb3819f8898cd229a7349 100644 (file)
@@ -3472,10 +3472,9 @@ package body Sem_Ch6 is
 
    procedure Cannot_Inline (Msg : String; N : Node_Id; Subp : Entity_Id) is
    begin
-      --  Do not emit warning if this is a predefined unit which is not
-      --  the main unit. With validity checks enabled, some predefined
-      --  subprograms may contain nested subprograms and become ineligible
-      --  for inlining.
+      --  Do not emit warning if this is a predefined unit which is not the
+      --  main unit. With validity checks enabled, some predefined subprograms
+      --  may contain nested subprograms and become ineligible for inlining.
 
       if Is_Predefined_File_Name (Unit_File_Name (Get_Source_Unit (Subp)))
         and then not In_Extended_Main_Source_Unit (Subp)
@@ -4490,8 +4489,8 @@ package body Sem_Ch6 is
          end;
       end if;
 
-      --  If there is an overridden subprogram, then check that there is not
-      --  "not overriding" indicator, and mark the subprogram as overriding.
+      --  If there is an overridden subprogram, then check that there is no
+      --  "not overriding" indicator, and mark the subprogram as overriding.
       --  This is not done if the overridden subprogram is marked as hidden,
       --  which can occur for the case of inherited controlled operations
       --  (see Derive_Subprogram), unless the inherited subprogram's parent
@@ -4539,7 +4538,7 @@ package body Sem_Ch6 is
 
       --  If Subp is an operator, it may override a predefined operation, if
       --  it is defined in the same scope as the type to which it applies.
-      --  In that case overridden_subp is empty because of our implicit
+      --  In that case Overridden_Subp is empty because of our implicit
       --  representation for predefined operators. We have to check whether the
       --  signature of Subp matches that of a predefined operator. Note that
       --  first argument provides the name of the operator, and the second
@@ -4551,7 +4550,7 @@ package body Sem_Ch6 is
       elsif Nkind (Subp) = N_Defining_Operator_Symbol then
          declare
             Typ : constant Entity_Id :=
-              Base_Type (Etype (First_Formal (Subp)));
+                    Base_Type (Etype (First_Formal (Subp)));
 
             Can_Override : constant Boolean :=
                              Operator_Matches_Spec (Subp, Subp)
@@ -4573,8 +4572,7 @@ package body Sem_Ch6 is
 
                elsif Can_Override then
                   Error_Msg_NE
-                    ("subprogram & overrides predefined operator ",
-                       Spec, Subp);
+                    ("subprogram& overrides predefined operator ", Spec, Subp);
                end if;
 
             elsif Must_Override (Spec) then
index 84bb34a66f23ba40dc9d94c14dd8eb59f83dac61..467fafadb3827fc8a0647b53ca0313a65bed5ee8 100644 (file)
@@ -3865,13 +3865,13 @@ package body Sem_Eval is
                if No (Typ1) then
                   Typ1 := E;
 
-                  --  Before emitting an error, check for the presence of a
-                  --  mixed-mode operation that specifies a fixed point type.
+               --  Before emitting an error, check for the presence of a
+               --  mixed-mode operation that specifies a fixed point type.
 
                elsif Is_Relational
                  and then
                    (Is_Mixed_Mode_Operand (Left_Opnd (N))
-                    or else Is_Mixed_Mode_Operand (Right_Opnd (N)))
+                     or else Is_Mixed_Mode_Operand (Right_Opnd (N)))
                  and then Is_Fixed_Point_Type (E) /= Is_Fixed_Point_Type (Typ1)
 
                then