This is the mail archive of the 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]

Unreviewed^2 -fwrapv patch

Just a reminder that my patch to add a flag_wrapv flag to GCC is
still awaiting review, despite several supportive e-mails:

This allows the middle and back-ends to distinguish between C/C++'s
undefined signed arithmetic overflow semantics and wrap-around two's
complement overflow semantics (as required by the Java Language

In addition to the new C test case in the patch above, I'd like to
thank Andrew Haley for contributing the following libjava.lang test
that demonstrates gcj's current non-compliance.  The test passes with
the -fwrapv patch above but fails without it.  I can file a PR in
GNATS if that will help expedite the review process :>

Many thanks in advance,

2003-05-09  Andrew Haley  <>
	    Roger Sayle  <>

	* libjava.lang/ New file.
	* libjava.lang/Overflow.out: New file.

class Overflow
  static int test(int x)
    return (2*x)/2;

  public static void main(String argv[])
    int x = Integer.MAX_VALUE;

    if (test(x) == x)
      throw new RuntimeException ();

Roger Sayle,                         E-mail:
OpenEye Scientific Software,         WWW:
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833

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