This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Committed] X % -Y -> X % Y is valid only for TRUNC_MOD_EXPR
- From: Laurent GUERBY <laurent at guerby dot net>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: roger at eyesopen dot com, gcc-patches at gcc dot gnu dot org
- Date: Mon, 02 Aug 2004 20:13:28 +0200
- Subject: Re: [Committed] X % -Y -> X % Y is valid only for TRUNC_MOD_EXPR
- References: <10408021745.AA03900@vlsi1.ultra.nyu.edu>
On Mon, 2004-08-02 at 19:45, Richard Kenner wrote:
> Hopefully, there's already a suitable ACATS test to prevent someone
> from making the same mistake in future.
>
> Indeed there is: that's how I found this (my notes on which one it was
> are at home).
Since this is in the Ada Reference Manual at section 4.5.5 the
ACATS test for it is named c455*, in this case this looks like
be c45503a.ada:
I4 : INTEGER := 4;
N5 : INTEGER := -5;
N4 : INTEGER := -4;
IF I11 MOD N5 /= N4 THEN
FAILED ( "INCORRECT RESULT FOR I11 MOD N5" );
END IF;
This tests makes it real hard to get "mod" and "rem" wrong unnoticed,
version b c do check short and long too.
Laurent