re PR ada/30740 (Improper semantics in gnat's compilation of certain expressions...
authorSamuel Tardieu <sam@rfc1149.net>
Tue, 20 May 2008 20:24:33 +0000 (20:24 +0000)
committerSamuel Tardieu <sam@gcc.gnu.org>
Tue, 20 May 2008 20:24:33 +0000 (20:24 +0000)
    gcc/testsuite/
PR ada/30740
* gnat.dg/modular.adb: New test.

From-SVN: r135675

gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/modular.adb [new file with mode: 0644]

index 0ff1a091d549695b991f00411d18ac610c01bb03..c49408661e6715a24493750c92d22d7c55b58eea 100644 (file)
@@ -1,3 +1,8 @@
+2008-05-20  Samuel Tardieu  <sam@rfc1149.net>
+
+       PR ada/30740
+       * gnat.dg/modular.adb: New test.
+
 2008-05-20  Jan Sjodin  <jan.sjodin@amd.com>
            Sebastian Pop  <sebastian.pop@amd.com>
 
diff --git a/gcc/testsuite/gnat.dg/modular.adb b/gcc/testsuite/gnat.dg/modular.adb
new file mode 100644 (file)
index 0000000..1eff333
--- /dev/null
@@ -0,0 +1,16 @@
+-- { dg-do run }
+with Ada.Text_IO;
+procedure Modular is
+   type T1 is mod 9;
+   package T1_IO is new Ada.Text_IO.Modular_IO(T1);
+   X: T1 := 8;
+   J1: constant := 5;
+begin
+   for J2 in 5..5 loop
+      pragma Assert(X*(2**J1) = X*(2**J2));
+      if X*(2**J1) /= X*(2**J2) then
+         Ada.Text_IO.Put_Line("Failed");
+         raise Program_Error;
+      end if;
+   end loop;
+end Modular;