When compiled with 4.2.4 at -O3 -gnato cg460011 passes: ,.,. C460011 ACATS 2.5 08-06-19 08:49:17 ---- C460011 Check that conversion to a modular type raises Constraint_Error when the operand value is outside the base range of the modular type. ==== C460011 PASSED ============================. Whereas when compiled at -O3 -gnato on 4.3.1 and 4.4 20080618 it fails: ,.,. C460011 ACATS 2.5 08-06-19 08:49:17 ---- C460011 Check that conversion to a modular type raises Constraint_Error when the operand value is outside the base range of the modular type. ==== C460011 PASSED ============================. To reproduce: $ gnatchop ../../trunk/gcc/testsuite/ada/acats/support/rep* ../../trunk/gcc/testsuite/ada/acats/tests/c4/c460011.a $ gnatmake -O3 -gnato c460011.adb $ ./c460011
Ooops paster the wrong output, the FAILED message with 4.3.1/4.4 is: ,.,. C460011 ACATS 2.5 08-06-19 08:51:01 ---- C460011 Check that conversion to a modular type raises Constraint_Error when the operand value is outside the base range of the modular type. * C460011 Halfway => Big, 3. * C460011 Halfway => Also_Big, 3. * C460011 Halfway => Also_Big, -3. **** C460011 FAILED ****************************.
I would bet this is VRP triggered by more inlining.
Setting to P4 as an Ada bug, please restore to P3 if a C or C++ testcase is found.
4.3.2 is released, changing milestones to 4.3.3.
Reproducible on x86.
Investigating.
> I would bet this is VRP triggered by more inlining. It's constant-folding triggered by more inlining, this already fails at -O0: procedure P is type Unsigned_Over_8 is mod 2**8+2; type Signed_Over_8 is range -200 .. 200; procedure Assert(Truth: Boolean) is begin if not Truth then raise Program_Error; end if; end; type Decim is delta 0.1 digits 5; Halfway : Decim := 2.5; Neg_Half : Decim := -2.5; Big : Unsigned_Over_8; Also_Big : Signed_Over_8; begin Big := Unsigned_Over_8 (Halfway); -- Rounds up by 4.6(33). Assert(Big = 3); Also_Big := Signed_Over_8 (Halfway); -- Rounds up by 4.6(33). Assert(Also_Big = 3); Also_Big := Signed_Over_8 (Neg_Half); -- Rounds down by 4.6(33). Assert(Also_Big = -3); end;
Subject: Bug 36575 Author: ebotcazou Date: Sun Sep 28 15:12:07 2008 New Revision: 140734 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140734 Log: PR middle-end/36575 * fold-const (div_and_round_double) <ROUND_DIV_EXPR>: Fix typo. Added: trunk/gcc/testsuite/gnat.dg/conv_decimal.adb Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog
Subject: Bug 36575 Author: ebotcazou Date: Sun Sep 28 15:13:52 2008 New Revision: 140735 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140735 Log: PR middle-end/36575 * fold-const (div_and_round_double) <ROUND_DIV_EXPR>: Fix typo. Added: branches/gcc-4_3-branch/gcc/testsuite/gnat.dg/conv_decimal.adb Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/fold-const.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
Subject: Bug 36575 Author: ebotcazou Date: Sun Sep 28 15:15:16 2008 New Revision: 140736 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140736 Log: PR middle-end/36575 * fold-const (div_and_round_double) <ROUND_DIV_EXPR>: Fix typo. Added: branches/gcc-4_2-branch/gcc/testsuite/gnat.dg/conv_decimal.adb Modified: branches/gcc-4_2-branch/gcc/ChangeLog branches/gcc-4_2-branch/gcc/fold-const.c branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
Thanks for reporting the problem.