]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
uninit testcase for PR65244
authorRichard Biener <rguenther@suse.de>
Wed, 31 Aug 2022 09:05:33 +0000 (11:05 +0200)
committerRichard Biener <rguenther@suse.de>
Wed, 31 Aug 2022 09:07:28 +0000 (11:07 +0200)
The PR65244 has an issue with code in init_from_control_deps
for which there's no direct testcase.  The following adds one.

PR tree-optimization/65244
* gcc.dg/uninit-pr65244-1.c: New testcase.

gcc/testsuite/gcc.dg/uninit-pr65244-1.c [new file with mode: 0644]

diff --git a/gcc/testsuite/gcc.dg/uninit-pr65244-1.c b/gcc/testsuite/gcc.dg/uninit-pr65244-1.c
new file mode 100644 (file)
index 0000000..7c1d910
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+extern void __attribute__((noreturn)) abort (void);
+
+int foo (int flag, int val)
+{
+  int tem;
+  if (flag)
+    {
+      if (val == 0)
+        abort ();
+      tem = val;
+    }
+  /* large - prevent jump threading */
+  __asm__ volatile ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
+  if (flag)
+    return tem; /* { dg-bogus "uninitialized" } */
+  return 0;
+}