aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--simplify.c1
-rw-r--r--validation/kill-slice.c19
2 files changed, 20 insertions, 0 deletions
diff --git a/simplify.c b/simplify.c
index 2a1f0b20..90e45bf1 100644
--- a/simplify.c
+++ b/simplify.c
@@ -203,6 +203,7 @@ void kill_instruction(struct instruction *insn)
case OP_PTRCAST:
case OP_SETVAL:
case OP_NOT: case OP_NEG:
+ case OP_SLICE:
kill_use(&insn->src1);
break;
diff --git a/validation/kill-slice.c b/validation/kill-slice.c
new file mode 100644
index 00000000..00db0e0f
--- /dev/null
+++ b/validation/kill-slice.c
@@ -0,0 +1,19 @@
+struct bar {
+ int x;
+ int y[2];
+};
+struct bar bar(void);
+
+int foo(void)
+{
+ int x = bar().x;
+ return x & 0;
+}
+
+/*
+ * check-name: kill-slice
+ * check-command: test-linearize -Wno-decl $file
+ * check-output-ignore
+ *
+ * check-output-excludes: slice\\.
+ */