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]

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:

http://gcc.gnu.org/ml/gcc-patches/2003-03/msg02126.html
http://gcc.gnu.org/ml/gcc-patches/2003-03/msg01727.html

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
Specification).

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  <aph@redhat.com>
	    Roger Sayle  <roger@eyesopen.com>

	* libjava.lang/Overflow.java: 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
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
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]