diff options
author | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-31 13:23:32 +0000 |
---|---|---|
committer | sayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-31 13:23:32 +0000 |
commit | b24bee039721e7304575c4c0b93bb1601dd63463 (patch) | |
tree | ae8dcbb261aaadbfa874d60f1fccd8dd93248b50 /gcc/flags.h | |
parent | 7bfd46d1db1b9ad908c67e722ca2e3221481c938 (diff) | |
download | gcc-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 'gcc/flags.h')
-rw-r--r-- | gcc/flags.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/flags.h b/gcc/flags.h index 4050517d379..c90428816d7 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -585,6 +585,9 @@ extern int frame_pointer_needed; for PLUS / SUB / MULT. */ extern int flag_trapv; +/* Nonzero if the signed arithmetic overflow should wrap around. */ +extern int flag_wrapv; + /* Value of the -G xx switch, and whether it was passed or not. */ extern unsigned HOST_WIDE_INT g_switch_value; extern int g_switch_set; |