aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2025-03-04 09:52:22 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2025-03-04 09:52:22 +0100
commitccf9db9a6fa4b5bc7aad5e9603e2ac71984142a0 (patch)
treefba4340d7d0c7f8ab2079c3331ba26d87f5b56c7 /gcc
parent5bd664838398980f1c8af60a946947ff83744fcc (diff)
downloadgcc-ccf9db9a6fa4b5bc7aad5e9603e2ac71984142a0.zip
gcc-ccf9db9a6fa4b5bc7aad5e9603e2ac71984142a0.tar.gz
gcc-ccf9db9a6fa4b5bc7aad5e9603e2ac71984142a0.tar.bz2
testsuite: Add tests for already fixed PR [PR119071]
Uros' r15-7793 fixed this PR as well, I'm just committing tests from the PR so that it can be closed. 2025-03-04 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/119071 * gcc.dg/pr119071.c: New test. * gcc.c-torture/execute/pr119071.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr119071.c15
-rw-r--r--gcc/testsuite/gcc.dg/pr119071.c45
2 files changed, 60 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr119071.c b/gcc/testsuite/gcc.c-torture/execute/pr119071.c
new file mode 100644
index 0000000..91f29cc
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr119071.c
@@ -0,0 +1,15 @@
+/* PR rtl-optimization/119071 */
+
+int a, b;
+
+int
+main ()
+{
+ int c = 0;
+ if (a + 2)
+ c = 1;
+ int d = (1 + c - 2 + c == 1) - 1;
+ b = ((d + 1) << d) + d;
+ if (b != 1)
+ __builtin_abort ();
+}
diff --git a/gcc/testsuite/gcc.dg/pr119071.c b/gcc/testsuite/gcc.dg/pr119071.c
new file mode 100644
index 0000000..ade1d28
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr119071.c
@@ -0,0 +1,45 @@
+/* PR rtl-optimization/119071 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fgimple" } */
+
+int a, b;
+
+int __GIMPLE (ssa,startwith("expand"))
+foo (void)
+{
+ int _1;
+ int _2;
+ int _3;
+ int _5;
+ _Bool _7;
+ int _8;
+ int _9;
+ _Bool _14;
+ int _15;
+ int _16;
+ _Bool _17;
+ int _18;
+
+ __BB(2):
+ _1 = a;
+ _17 = _1 != _Literal (int) -2;
+ _18 = (int) _17;
+ _2 = _18 + _Literal (int) -1;
+ _3 = _2 + _18;
+ _14 = _3 != 1;
+ _15 = (int) _14;
+ _16 = -_15;
+ _7 = _3 == 1;
+ _9 = (int) _7;
+ _5 = _9 << _16;
+ _8 = _5 - _15;
+ b = _8;
+ return _8;
+}
+
+int
+main ()
+{
+ if (foo () != 1)
+ __builtin_abort ();
+}