]> gcc.gnu.org Git - gcc.git/commitdiff
[multiple changes]
authorPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 16 Nov 2017 12:53:46 +0000 (12:53 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Thu, 16 Nov 2017 12:53:46 +0000 (12:53 +0000)
2017-11-16  Sylvain Dailler  <dailler@adacore.com>

* sem_util.adb (Get_Enum_Lit_From_Pos): Add a condition for Pos
lower than 0.

2017-11-16  Bob Duff  <duff@adacore.com>

* sem_ch13.adb (Check_Expr_Constants): Avoid error message in case of
System'To_Address.

From-SVN: r254818

gcc/ada/ChangeLog
gcc/ada/sem_ch13.adb
gcc/ada/sem_util.adb

index 3f1e51f4acf3fd408fae2536ccf8180975aa040e..1f3cf290cd5d562ce8a6ed902af8033ee95f4336 100644 (file)
@@ -1,3 +1,13 @@
+2017-11-16  Sylvain Dailler  <dailler@adacore.com>
+
+       * sem_util.adb (Get_Enum_Lit_From_Pos): Add a condition for Pos
+       lower than 0.
+
+2017-11-16  Bob Duff  <duff@adacore.com>
+
+       * sem_ch13.adb (Check_Expr_Constants): Avoid error message in case of
+       System'To_Address.
+
 2017-11-16  Yannick Moy  <moy@adacore.com>
 
        * sem_elab.adb (Include): Fix mode of parameter Curr to out.
index 83d31081facc144491d9b4eddc4c4d2958cb5172..b501e14f31ed682dac5322dd8af0e8d3f983b33a 100644 (file)
@@ -9783,6 +9783,15 @@ package body Sem_Ch13 is
                then
                   Check_At_Constant_Address (Prefix (Nod));
 
+               --  Normally, System'To_Address will have been transformed into
+               --  an Unchecked_Conversion, but in -gnatc mode, it will not,
+               --  and we don't want to give an error, because the whole point
+               --  of 'To_Address is that it is static.
+
+               elsif Attribute_Name (Nod) = Name_To_Address then
+                  pragma Assert (Operating_Mode = Check_Semantics);
+                  null;
+
                else
                   Check_Expr_Constants (Prefix (Nod));
                   Check_List_Constants (Expressions (Nod));
index 136505f23d583de132084e0e0372a39140b9809c..576a759618033af62033b3f3e779ef584d2d239b 100644 (file)
@@ -9085,6 +9085,12 @@ package body Sem_Util is
          end if;
 
          Lit := First_Literal (Btyp);
+
+         --  Position in the enumeration type starts at 0.
+         if UI_To_Int (Pos) < 0 then
+            raise Constraint_Error;
+         end if;
+
          for J in 1 .. UI_To_Int (Pos) loop
             Next_Literal (Lit);
 
This page took 0.100298 seconds and 5 git commands to generate.