aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/optim
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-06-16 19:28:08 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-11-10 18:13:08 +0100
commita2011cb2a0a5c72fc2f09e123f38649cbe34c570 (patch)
treee2aa9c37cc83233d59eaec86235b185d563dc360 /validation/optim
parent937d0e545ff0ea703be2062dcf3f3ab717183ac7 (diff)
downloadsparse-dev-a2011cb2a0a5c72fc2f09e123f38649cbe34c570.tar.gz
volatile loads are side-effects too
Some branch simplifications are only valid if the branch is free of side-effects. The check is done in flow.c:bb_has_side_effects() but currently deosn't take in account the fact that a volatile load is also a side-effect. Fix this by adding the appropriate check. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim')
-rw-r--r--validation/optim/volatile-side-effect.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/validation/optim/volatile-side-effect.c b/validation/optim/volatile-side-effect.c
new file mode 100644
index 00000000..842b7228
--- /dev/null
+++ b/validation/optim/volatile-side-effect.c
@@ -0,0 +1,13 @@
+void foo(int p, volatile int *ptr)
+{
+ p ? : *ptr;
+ p ? : *ptr;
+}
+
+/*
+ * check-name: volatile-side-effect
+ * check-command: test-linearize -Wno-decl $file
+ * check-output-ignore
+ *
+ * check-output-pattern(2): load
+ */