]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Thu, 11 Apr 2013 12:38:20 +0000 (14:38 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Thu, 11 Apr 2013 12:38:20 +0000 (14:38 +0200)
2013-04-11  Thomas Quinot  <quinot@adacore.com>

* sem_util.adb (Set_Entity_With_Style_Check): Fix logic of
check for implementation defined identifiers.

2013-04-11  Yannick Moy  <moy@adacore.com>

* checks.adb (Apply_Type_Conversion_Checks): Add an explanation
of why range check and length are put on different nodes.
* exp_ch4.adb (Apply_Type_Conversion_Checks): Remove check marks
when doing their expansion.

From-SVN: r197776

gcc/ada/ChangeLog
gcc/ada/checks.adb
gcc/ada/exp_ch4.adb
gcc/ada/sem_util.adb

index 203295010da2af7fac52416004a3d1a4b6cf54ea..cb502858934413192c22bf14559b391e26f12969 100644 (file)
@@ -1,3 +1,15 @@
+2013-04-11  Thomas Quinot  <quinot@adacore.com>
+
+       * sem_util.adb (Set_Entity_With_Style_Check): Fix logic of
+       check for implementation defined identifiers.
+
+2013-04-11  Yannick Moy  <moy@adacore.com>
+
+       * checks.adb (Apply_Type_Conversion_Checks): Add an explanation
+       of why range check and length are put on different nodes.
+       * exp_ch4.adb (Apply_Type_Conversion_Checks): Remove check marks
+       when doing their expansion.
+
 2013-04-11  Ed Schonberg  <schonberg@adacore.com>
 
        * sem_util.ads, sem_util.adb (Get_Incomplete_View_Of_Ancestor):
index 05a0c6f8c30cf778541f5e9e2aab85db40676fdd..640f0127c3cb4cbb58f77eacd7f50c157f84b4b5 100644 (file)
@@ -3248,7 +3248,9 @@ package body Checks is
       --  expansion, to take into accounts changes of representation. The
       --  checks become range checks on the base type or length checks on the
       --  subtype, depending on whether the target type is unconstrained or
-      --  constrained.
+      --  constrained. Note that the range check is put on the expression of a
+      --  type conversion, while the length check is put on the type conversion
+      --  itself.
 
       elsif Is_Array_Type (Target_Type) then
          if Is_Constrained (Target_Type) then
index be011f8c7b2cd5e8ec07d854d9847c4864b8f6cc..480151df7091b4d3397f2ceb949bcfe16c2fe2ef 100644 (file)
@@ -10053,6 +10053,19 @@ package body Exp_Ch4 is
    --  Start of processing for Expand_N_Type_Conversion
 
    begin
+      --  First remove check marks put by the semantic analysis on the type
+      --  conversion between array types. The front end expands these checks
+      --  explicitly, so they should not be set in the tree passed to the back
+      --  end.
+
+      if Is_Array_Type (Target_Type) then
+         if Is_Constrained (Target_Type) then
+            Set_Do_Length_Check (N, False);
+         else
+            Set_Do_Range_Check (Operand, False);
+         end if;
+      end if;
+
       --  Nothing at all to do if conversion is to the identical type so remove
       --  the conversion completely, it is useless, except that it may carry
       --  an Assignment_OK attribute, which must be propagated to the operand.
index 071bdd5a20c68ed206ed6bf811792e9b244d16f0..2892c8800810fd5efe3c85359a54307237642734 100644 (file)
@@ -13419,9 +13419,10 @@ package body Sem_Util is
          --  the entities within it).
 
          if (Is_Implementation_Defined (Val)
+               or else
+             Is_Implementation_Defined (Scope (Val)))
               and then not (Ekind_In (Val, E_Package, E_Generic_Package)
-                              and then Is_Library_Level_Entity (Val)))
-           or else Is_Implementation_Defined (Scope (Val))
+                              and then Is_Library_Level_Entity (Val))
          then
             Check_Restriction (No_Implementation_Identifiers, N);
          end if;