aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-08-01 13:06:54 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-02-11 10:16:07 +0100
commitfdd1645dc1a80d76dfffb621cfca778d1ce12d52 (patch)
treec7103a70fa393636492bfe3f627607861272b974 /validation
parent71205271e3c082b66a21640b2e92f21f5eaa7ad0 (diff)
downloadsparse-dev-fdd1645dc1a80d76dfffb621cfca778d1ce12d52.tar.gz
fix missing checks for deleted instructions
Instructions with a null ->bb are instructions which have been killed. As such, they must thus always be ignored but it's not always the case. Fix this by adding a check for null ->bb where there is some looping over all the instructions of a basic block. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/mem2reg/killed-insn.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/validation/mem2reg/killed-insn.c b/validation/mem2reg/killed-insn.c
new file mode 100644
index 00000000..641525d3
--- /dev/null
+++ b/validation/mem2reg/killed-insn.c
@@ -0,0 +1,15 @@
+static int g;
+static void foo(void)
+{
+ int a[2] = { };
+ a;
+ a[1] = g;
+}
+
+/*
+ * check-name: killed-insn
+ * check-command: test-linearize -fdump-ir=mem2reg $file
+ *
+ * check-output-ignore
+ * check-output-excludes: store\.
+ */