From e4ae405a3508cd881d708465fd9fd167a7cc1c28 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 20 May 2008 20:24:33 +0000 Subject: [PATCH] re PR ada/30740 (Improper semantics in gnat's compilation of certain expressions involving modular arithmetic) gcc/testsuite/ PR ada/30740 * gnat.dg/modular.adb: New test. From-SVN: r135675 --- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gnat.dg/modular.adb | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/gnat.dg/modular.adb diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ff1a091d54..c49408661e6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-20 Samuel Tardieu + + PR ada/30740 + * gnat.dg/modular.adb: New test. + 2008-05-20 Jan Sjodin Sebastian Pop diff --git a/gcc/testsuite/gnat.dg/modular.adb b/gcc/testsuite/gnat.dg/modular.adb new file mode 100644 index 00000000000..1eff3332708 --- /dev/null +++ b/gcc/testsuite/gnat.dg/modular.adb @@ -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; -- 2.30.2