diff options
author | Richard Guenther <rguenther@suse.de> | 2007-11-12 14:16:05 +0000 |
---|---|---|
committer | Richard Guenther <rguenther@suse.de> | 2007-11-12 14:16:05 +0000 |
commit | 0e24095702120cd886820bfc4c61bb306a629290 (patch) | |
tree | fb294631ce72ef4c2afc3cd1f59f93a16cf0896a /gcc/testsuite/gcc.c-torture | |
parent | 608eab07d87470d6f41f40d1a98f2eebc536ff9a (diff) |
2007-11-12 Richard Guenther <rguenther@suse.de>
PR middle-end/34070
* fold-const.c (fold_binary): If testing for non-negative
operands with tree_expr_nonnegative_warnv_p make sure to
use op0 which has all (sign) conversions retained.
* gcc.c-torture/execute/pr34070-1.c: New testcase.
* gcc.c-torture/execute/pr34070-2.c: Likewise.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@130098 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr34070-1.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr34070-2.c | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34070-1.c b/gcc/testsuite/gcc.c-torture/execute/pr34070-1.c new file mode 100644 index 00000000000..6589bb0c095 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34070-1.c @@ -0,0 +1,13 @@ +extern void abort (void); + +int f(unsigned int x) +{ + return ((int)x) % 4; +} + +int main() +{ + if (f(-1) != -1) + abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr34070-2.c b/gcc/testsuite/gcc.c-torture/execute/pr34070-2.c new file mode 100644 index 00000000000..4c1ce7b0231 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr34070-2.c @@ -0,0 +1,13 @@ +extern void abort (void); + +int f(unsigned int x, int n) +{ + return ((int)x) / (1 << n); +} + +int main() +{ + if (f(-1, 1) != 0) + abort (); + return 0; +} |