From ef53f36f968942ed111f962ca8ec479f9ed1f0e3 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 12 Dec 2014 13:43:34 +0100 Subject: [PATCH] re PR rtl-optimization/64255 (failures with -O2 optimization on i >= 0 ? (unsigned long) i : - (unsigned long) i) PR rtl-optimization/64255 * gcc.c-torture/execute/pr64255.c: New test. PR rtl-optimization/64260 * gcc.c-torture/execute/pr64260.c: New test. From-SVN: r218665 --- gcc/testsuite/ChangeLog | 8 ++++++ gcc/testsuite/gcc.c-torture/execute/pr64255.c | 28 +++++++++++++++++++ gcc/testsuite/gcc.c-torture/execute/pr64260.c | 25 +++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr64255.c create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr64260.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fc4869fe255..e4eb34b5702 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2014-12-12 Jakub Jelinek + + PR rtl-optimization/64255 + * gcc.c-torture/execute/pr64255.c: New test. + + PR rtl-optimization/64260 + * gcc.c-torture/execute/pr64260.c: New test. + 2014-12-12 Zhenqiang Chen * gcc.dg/pr64007.c: New test. diff --git a/gcc/testsuite/gcc.c-torture/execute/pr64255.c b/gcc/testsuite/gcc.c-torture/execute/pr64255.c new file mode 100644 index 00000000000..447638af35f --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr64255.c @@ -0,0 +1,28 @@ +/* PR rtl-optimization/64255 */ + +__attribute__((noinline, noclone)) void +bar (long i, unsigned long j) +{ + if (i != 1 || j != 1) + __builtin_abort (); +} + +__attribute__((noinline, noclone)) void +foo (long i) +{ + unsigned long j; + + if (!i) + return; + j = i >= 0 ? (unsigned long) i : - (unsigned long) i; + if ((i >= 0 ? (unsigned long) i : - (unsigned long) i) != j) + __builtin_abort (); + bar (i, j); +} + +int +main () +{ + foo (1); + return 0; +} diff --git a/gcc/testsuite/gcc.c-torture/execute/pr64260.c b/gcc/testsuite/gcc.c-torture/execute/pr64260.c new file mode 100644 index 00000000000..e6cd6c209ad --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr64260.c @@ -0,0 +1,25 @@ +/* PR rtl-optimization/64260 */ + +int a = 1, b; + +void +foo (char p) +{ + int t = 0; + for (; b < 1; b++) + { + int *s = &a; + if (--t) + *s &= p; + *s &= 1; + } +} + +int +main () +{ + foo (0); + if (a != 0) + __builtin_abort (); + return 0; +} -- 2.30.2