summaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-31 13:23:32 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-05-31 13:23:32 +0000
commitb24bee039721e7304575c4c0b93bb1601dd63463 (patch)
treeae8dcbb261aaadbfa874d60f1fccd8dd93248b50 /libjava
parent7bfd46d1db1b9ad908c67e722ca2e3221481c938 (diff)
downloadgcc-b24bee039721e7304575c4c0b93bb1601dd63463.tar.gz
* flags.h (flag_wrapv): New flag controlling overflow semantics.
* toplev.c (flag_wrapv): Declare the variable with default false. (lang_independent_options): New option "-fwrapv" to set the above. * fold-const.c (extract_muldiv_1): Disable optimization of (2*x)/2 as x, when signed arithmetic overflow wraps around. (fold): Optimize "-A - B" as "-B - A" if overflow wraps around. * loop.c (basic_induction_var): Ignore BIVs that rely on undefined overflow when flag_wrapv is true. * java/lang.c (java_init_options): Prescribe wrap-around two's complement arithmetic overflow by setting flag_wrapv. * doc/invoke.texi: Document new -fwrapv command line option. * doc/c-tree.texi: Mention that the overflow semantics of NEGATE_EXPR, PLUS_EXPR, MINUS_EXPR and MULT_EXPR is dependent upon both flag_wrapv and flag_trapv. * gcc.dg/fwrapv-1.c: New test case. * gcc.dg/fwrapv-2.c: New test case. * libjava.lang/Overflow.java: New test. * libjava.lang/Overflow.out: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67270 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/testsuite/ChangeLog5
-rw-r--r--libjava/testsuite/libjava.lang/Overflow.java16
-rw-r--r--libjava/testsuite/libjava.lang/Overflow.out0
3 files changed, 21 insertions, 0 deletions
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog
index 6ea10fff1be..ee7883b2f8f 100644
--- a/libjava/testsuite/ChangeLog
+++ b/libjava/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-31 Roger Sayle <roger@eyesopen.com>
+
+ * libjava.lang/Overflow.java: New test.
+ * libjava.lang/Overflow.out: New file.
+
2003-05-06 Tom Tromey <tromey@redhat.com>
* libjava.lang/verify.java: New file.
diff --git a/libjava/testsuite/libjava.lang/Overflow.java b/libjava/testsuite/libjava.lang/Overflow.java
new file mode 100644
index 00000000000..312e9cb209f
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/Overflow.java
@@ -0,0 +1,16 @@
+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 ();
+ }
+}
+
diff --git a/libjava/testsuite/libjava.lang/Overflow.out b/libjava/testsuite/libjava.lang/Overflow.out
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/libjava/testsuite/libjava.lang/Overflow.out