uninit testcase for PR65244

Message ID 20220831090719.8CBA61332D@imap2.suse-dmz.suse.de
State New, archived
Headers
Series uninit testcase for PR65244 |

Commit Message

Richard Biener Aug. 31, 2022, 9:07 a.m. UTC
  The PR65244 has an issue with code in init_from_control_deps
for which there's no direct testcase.  The following adds one.

Pushed.

	PR tree-optimization/65244
	* gcc.dg/uninit-pr65244-1.c: New testcase.
---
 gcc/testsuite/gcc.dg/uninit-pr65244-1.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 gcc/testsuite/gcc.dg/uninit-pr65244-1.c
  

Patch

diff --git a/gcc/testsuite/gcc.dg/uninit-pr65244-1.c b/gcc/testsuite/gcc.dg/uninit-pr65244-1.c
new file mode 100644
index 00000000000..7c1d910d546
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/uninit-pr65244-1.c
@@ -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;
+}