diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-16 14:56:34 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-06-16 14:56:34 +0000 |
commit | 58b22aa6b27e40b698a5a124ac8294e85adead64 (patch) | |
tree | 7073ab53b36f03e3e04cb67e6df2ca77822bd4df /gcc/testsuite/gcc.dg/pr15785-1.c | |
parent | 50e6dbf3d29376a62eb0a58068f8e794fb38d24b (diff) | |
download | gcc-58b22aa6b27e40b698a5a124ac8294e85adead64.tar.gz |
2006-06-16 Richard Guenther <rguenther@suse.de>
PR middle-end/27116
* fold-const.c (negate_expr_p): Do not introduce undefined
overflow in negating INTEGER_CSTs.
(fold_negate_expr): Rename from negate_expr. Revert last
change for folding BIT_NOT_EXPR. Change semantics to
return NULL_TREE for non-simplified negations. Do not
strip type conversions and unify type handling.
(negate_expr): New function, wrap around fold_negate_expr
but ensure building a tree always. Strip type conversions
here, fold to result type.
(fold_unary): Use fold_negate_expr for folding NEGATE_EXPR.
* gcc.dg/pr15785-1.c: Revert last change.
* gcc.dg/torture/pr27116-2.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114723 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/pr15785-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr15785-1.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pr15785-1.c b/gcc/testsuite/gcc.dg/pr15785-1.c index 5e79ec50bbb..47cd3d7b01b 100644 --- a/gcc/testsuite/gcc.dg/pr15785-1.c +++ b/gcc/testsuite/gcc.dg/pr15785-1.c @@ -11,6 +11,11 @@ void b (int x) { link_error (); } +void c (int x) { + if (!(- (~x) - x)) + link_error (); +} + void d (int x) { if (!(~ (-x) - x)) link_error (); @@ -29,6 +34,7 @@ void f (int x) { int main (int argc, char *argv[]) { a(argc); b(argc); + c(argc); d(argc); e(argc); f(argc); |