]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
trans.c (Loop_Statement_to_gnu): Use gnat_type_for_size directly to obtain an unsigne...
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 22 Oct 2012 08:19:58 +0000 (08:19 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Mon, 22 Oct 2012 08:19:58 +0000 (08:19 +0000)
* gcc-interface/trans.c (Loop_Statement_to_gnu): Use gnat_type_for_size
directly to obtain an unsigned version of the base type.

From-SVN: r192669

gcc/ada/ChangeLog
gcc/ada/gcc-interface/trans.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/modular4.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/modular4_pkg.ads [new file with mode: 0644]

index 30428c6ce3253b7de9694c13ea51b6e1529613f3..5d39ca7f876b0800e362b1d41deb92a23e76f94c 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-22  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/trans.c (Loop_Statement_to_gnu): Use gnat_type_for_size
+       directly to obtain an unsigned version of the base type.
+
 2012-10-22  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Out_Parameter>: Do not
index aac483cafaa759fcf6022894a87a620338ea4fdb..c4a40c72cc4df0304168a70c1e0a83cf1926ebd0 100644 (file)
@@ -2431,7 +2431,8 @@ Loop_Statement_to_gnu (Node_Id gnat_node)
            {
              if (TYPE_PRECISION (gnu_base_type)
                  > TYPE_PRECISION (size_type_node))
-               gnu_base_type = gnat_unsigned_type (gnu_base_type);
+               gnu_base_type
+                 = gnat_type_for_size (TYPE_PRECISION (gnu_base_type), 1);
              else
                gnu_base_type = size_type_node;
 
index 7f2ddb1015169039e8c80e974794254b5393983d..dbe23bf7cd7e86cd6d78be0435e847e8e3aa441d 100644 (file)
@@ -1,3 +1,8 @@
+2012-10-22  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/modular4.adb: New test.
+       * gnat.dg/modular4_pkg.ads: New helper.
+
 2012-10-21  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/specs/atomic1.ads: XFAIL on MIPS.
diff --git a/gcc/testsuite/gnat.dg/modular4.adb b/gcc/testsuite/gnat.dg/modular4.adb
new file mode 100644 (file)
index 0000000..e8e8f29
--- /dev/null
@@ -0,0 +1,11 @@
+-- { dg-do compile }
+-- { dg-options "-O" }
+
+with Modular4_Pkg; use Modular4_Pkg;
+
+procedure Modular4 is
+begin
+  for I in Zero .. F mod 8 loop
+    raise Program_Error;
+  end loop;
+end;
diff --git a/gcc/testsuite/gnat.dg/modular4_pkg.ads b/gcc/testsuite/gnat.dg/modular4_pkg.ads
new file mode 100644 (file)
index 0000000..b380262
--- /dev/null
@@ -0,0 +1,9 @@
+package Modular4_Pkg is
+
+   type Word is mod 2**48;
+
+   Zero : constant Word := 0;
+
+   function F return Word;
+
+end Modular4_Pkg;