summaryrefslogtreecommitdiffstats
path: root/gcc/java
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 /gcc/java
parent7bfd46d1db1b9ad908c67e722ca2e3221481c938 (diff)
downloadppe42-gcc-b24bee039721e7304575c4c0b93bb1601dd63463.tar.gz
ppe42-gcc-b24bee039721e7304575c4c0b93bb1601dd63463.zip
* 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 'gcc/java')
-rw-r--r--gcc/java/ChangeLog5
-rw-r--r--gcc/java/lang.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 8dc9ecaf2e5..b41f316c5e2 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-31 Roger Sayle <roger@eyesopen.com>
+
+ * lang.c (java_init_options): Prescribe wrap-around two's
+ complement arithmetic overflow by setting flag_wrapv.
+
2003-05-29 Roger Sayle <roger@eyesopen.com>
* builtins.c (cos_builtin, sin_builtin, sqrt_builtin): Delete.
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 031ddcc38b8..918be0a5d7d 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.c
@@ -740,6 +740,9 @@ java_init_options (void)
/* In Java floating point operations never trap. */
flag_trapping_math = 0;
+
+ /* In Java arithmetic overflow always wraps around. */
+ flag_wrapv = 1;
}
static bool
OpenPOWER on IntegriCloud