]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Testcase for PR115492
authorRichard Biener <rguenther@suse.de>
Mon, 17 Jun 2024 07:23:25 +0000 (09:23 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 17 Jun 2024 12:39:30 +0000 (14:39 +0200)
This adds a testcase for the PR fixed with reversal of
r15-204-g7c469a9fc78550.

PR tree-optimization/115492
* gcc.dg/torture/pr115492.c: New testcase.

gcc/testsuite/gcc.dg/torture/pr115492.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/torture/pr115492.c b/gcc/testsuite/gcc.dg/torture/pr115492.c
new file mode 100644 (file)
index 0000000..4ecc060
--- /dev/null
@@ -0,0 +1,19 @@
+/* { dg-do run } */
+
+int a = 2, b=0, *c = &a, *d = &a, e=0;
+[[gnu::noipa]]
+void f(int) {}
+[[gnu::noipa]]
+int h(int *k) {
+  int ***j;
+  if (b) {
+    *j = &k; // Note the unintialized j is used here
+             // but since it is conditional and b is always zero, there should no
+             // effect otherwise.
+    ***j;
+  }
+  f(*k);
+  *d = e;
+  return *k;
+}
+int main() { if (h(c)) __builtin_abort(); }