diff options
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr45262.c')
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr45262.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr45262.c b/gcc/testsuite/gcc.c-torture/execute/pr45262.c new file mode 100644 index 000000000..72e186bf2 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr45262.c @@ -0,0 +1,33 @@ +/* PR middle-end/45262 */ + +extern void abort (void); + +int +foo (unsigned int x) +{ + return ((int) x < 0) || ((int) (-x) < 0); +} + +int +bar (unsigned int x) +{ + return x >> 31 || (-x) >> 31; +} + +int +main (void) +{ + if (foo (1) != 1) + abort (); + if (foo (0) != 0) + abort (); + if (foo (-1) != 1) + abort (); + if (bar (1) != 1) + abort (); + if (bar (0) != 0) + abort (); + if (bar (-1) != 1) + abort (); + return 0; +} |