diff options
author | Jakub Jelinek <jakub@redhat.com> | 2025-06-12 19:53:07 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2025-06-12 19:53:07 +0200 |
commit | 00aa59e5b120e4f5f70dcabafa57f7d4b5b9ad5d (patch) | |
tree | 29e6f75354599da0bafa85b135be4e25e68c11b7 | |
parent | c9a6c1b5a763d0d3f7a369ed281f9009f270939a (diff) | |
download | gcc-00aa59e5b120e4f5f70dcabafa57f7d4b5b9ad5d.zip gcc-00aa59e5b120e4f5f70dcabafa57f7d4b5b9ad5d.tar.gz gcc-00aa59e5b120e4f5f70dcabafa57f7d4b5b9ad5d.tar.bz2 |
testsuite: Add testcase for already fixed PR [PR120630]
These tests were broken by my r16-1398 PR120434 change and
fixed by r16-1482 PR120629 change.
Committing these to increase testsuite coverage.
2025-06-12 Jakub Jelinek <jakub@redhat.com>
PR middle-end/120630
* gcc.dg/pr120630.c: New test.
* gcc.c-torture/execute/pr120630.c: New test.
-rw-r--r-- | gcc/testsuite/gcc.c-torture/execute/pr120630.c | 29 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr120630.c | 25 |
2 files changed, 54 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr120630.c b/gcc/testsuite/gcc.c-torture/execute/pr120630.c new file mode 100644 index 0000000..46cfac9 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr120630.c @@ -0,0 +1,29 @@ +/* PR middle-end/120630 */ + +__attribute__((noipa)) int +foo (const char *x, ...) +{ + return *x; +} + +int a, b, c; +unsigned d = 1; + +int +main () +{ + if (a) + foo ("0"); + int e = -1; + if (a < 1) + { + e = c; + if (c) + while (1) + ; + } + b = (~e + 0UL) / -1; + if (d > b) + __builtin_abort (); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr120630.c b/gcc/testsuite/gcc.dg/pr120630.c new file mode 100644 index 0000000..14b0aaf --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr120630.c @@ -0,0 +1,25 @@ +/* PR middle-end/120630 */ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-tree-loop-im -fno-tree-loop-optimize -fno-tree-ch" } */ + +int a, c, d; + +void +foo (int b) +{ + a = b; +} + +int +main () +{ + while (d) + ; + for (c = 0; c > -3; c--) + { + long f = c; + foo (f >> 2); + } + if (a != -1) + __builtin_abort (); +} |