OSDN Git Service

* gcc-interface/trans.c (Loop_Statement_to_gnu): Use gnat_type_for_size
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Oct 2012 08:23:01 +0000 (08:23 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Oct 2012 08:23:01 +0000 (08:23 +0000)
directly to obtain an unsigned version of the base type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@192670 138bc75d-0d04-0410-961f-82ee72b054a4

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 f6a4f56..8f30d3a 100644 (file)
@@ -1,5 +1,10 @@
 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
        generate the special PARM_DECL for an Out parameter in LTO mode.
 
index 63363f5..aabe9b6 100644 (file)
@@ -2402,7 +2402,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 6db2f92..b954c9b 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;