diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-12 18:04:51 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-05-12 18:04:51 +0000 |
commit | 41944d974179cd14731f10e2aa9b209aa580d080 (patch) | |
tree | f91bc7ea5de431882167e85706d9084caba5de5d /gcc/testsuite/gcc.dg/no-strict-overflow-7.c | |
parent | 7561afbfaeb601471bee38498ec9e3905c38e6c6 (diff) |
* flags.h (POINTER_TYPE_OVERFLOW_UNDEFINED): Define.
* fold-const.c (fold_overflow_warning): Remove assertion.
(pointer_may_wrap_p): New static function.
(fold_comparison): If appropriate, test
POINTER_TYPE_OVERFLOW_UNDEFINED, and issue an overflow warning.
(fold_binary): Test POINTER_TYPE_OVERFLOW_UNDEFINED when
reassociating a pointer type.
* doc/invoke.texi (Optimize Options): Document that
-fstrict-overflow applies to pointer wraparound.
testsuite/:
* gcc.dg/strict-overflow-6.c: New.
* gcc.dg/no-strict-overflow-7.c: New.
* gcc.dg/Wstrict-overflow-22.c: New.
* gcc.c-torture/compile/20080419-1.c: New.
* gcc.dg/tree-ssa/loop-17.c: Use -O2.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_2-branch@135222 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/no-strict-overflow-7.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/no-strict-overflow-7.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/no-strict-overflow-7.c b/gcc/testsuite/gcc.dg/no-strict-overflow-7.c new file mode 100644 index 00000000000..07ad27b1f87 --- /dev/null +++ b/gcc/testsuite/gcc.dg/no-strict-overflow-7.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-fno-strict-overflow -O2 -fdump-tree-final_cleanup" } */ + +/* Source: Ian Lance Taylor. Dual of strict-overflow-6.c. */ + +/* We can only simplify the conditional when using strict overflow + semantics. */ + +int +foo (char* p) +{ + return p + 1000 < p; +} + +/* { dg-final { scan-tree-dump "\[+\]\[ \]*1000" "final_cleanup" } } */ +/* { dg-final { cleanup-tree-dump "final_cleanup" } } */ |