From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH 1/4] add testcases for COMPUTEDGOTO simplification
Date: Sat, 21 Nov 2020 21:52:57 +0100 [thread overview]
Message-ID: <20201121205300.94642-2-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20201121205300.94642-1-luc.vanoostenryck@gmail.com>
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
validation/optim/cgoto01.c | 25 +++++++++++++++++++++++++
validation/optim/cgoto02.c | 18 ++++++++++++++++++
validation/optim/cse-label.c | 14 ++++++++++++++
3 files changed, 57 insertions(+)
create mode 100644 validation/optim/cgoto01.c
create mode 100644 validation/optim/cgoto02.c
create mode 100644 validation/optim/cse-label.c
diff --git a/validation/optim/cgoto01.c b/validation/optim/cgoto01.c
new file mode 100644
index 000000000000..350c6cd99f08
--- /dev/null
+++ b/validation/optim/cgoto01.c
@@ -0,0 +1,25 @@
+void abort(void) __attribute__((__noreturn__));
+
+int foo(int a)
+{
+ void *label;
+
+ if (a == a)
+ label = &&L1;
+ else
+ label = &&L2;
+ goto *label;
+L1: return 0;
+L2: abort();
+}
+
+/*
+ * check-name: cgoto01
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-excludes: set\\.
+ * check-output-excludes: jmp
+ * check-output-excludes: call
+ */
diff --git a/validation/optim/cgoto02.c b/validation/optim/cgoto02.c
new file mode 100644
index 000000000000..5869d5b4a24d
--- /dev/null
+++ b/validation/optim/cgoto02.c
@@ -0,0 +1,18 @@
+int foo(int a)
+{
+ void *label = a ? &&l1 : &&l2;
+ goto *label;
+l1:
+ return a;
+l2:
+ return 0;
+}
+
+/*
+ * check-name: cgoto02
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: %arg1
+ */
diff --git a/validation/optim/cse-label.c b/validation/optim/cse-label.c
new file mode 100644
index 000000000000..e42968204615
--- /dev/null
+++ b/validation/optim/cse-label.c
@@ -0,0 +1,14 @@
+int foo(void)
+{
+label:
+ return &&label == &&label;
+}
+
+/*
+ * check-name: cse-label
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-returns: 1
+ */
--
2.29.2
next prev parent reply other threads:[~2020-11-21 20:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-21 20:52 [PATCH 0/4] simplification of computed goto Luc Van Oostenryck
2020-11-21 20:52 ` Luc Van Oostenryck [this message]
2020-11-21 20:52 ` [PATCH 2/4] simplify OP_COMPUTEDGOTO with unique and known target Luc Van Oostenryck
2020-11-21 20:52 ` [PATCH 3/4] simplify CGOTO(SEL(x, L1, L2)) into CBR x, L1, L2 Luc Van Oostenryck
2020-11-21 20:53 ` [PATCH 4/4] add a new instruction for label-as-value Luc Van Oostenryck
2020-11-21 21:09 ` [PATCH 0/4] simplification of computed goto Linus Torvalds
2020-11-21 21:40 ` Luc Van Oostenryck
2020-11-21 22:07 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201121205300.94642-2-luc.vanoostenryck@gmail.com \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).