aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/flow.c
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 /flow.c
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 'flow.c')
-rw-r--r--flow.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/flow.c b/flow.c
index 6b2c879a..1144bff4 100644
--- a/flow.c
+++ b/flow.c
@@ -169,6 +169,13 @@ static int bb_has_side_effects(struct basic_block *bb)
/* FIXME! This should take "const" etc into account */
return 1;
+ case OP_LOAD:
+ if (!insn->type)
+ return 1;
+ if (insn->type->ctype.modifiers & MOD_VOLATILE)
+ return 1;
+ continue;
+
case OP_STORE:
case OP_CONTEXT:
return 1;