This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Committed] X % -Y -> X % Y is valid only for TRUNC_MOD_EXPR


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]