aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/flow.c
diff options
authorJann Horn <jannh@google.com>2018-02-23 22:55:13 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-02-24 10:49:15 +0100
commit92fc6dac2eb886d048d215d2dd4f4f0aada4635e (patch)
tree8427114a449838f377f12ec6e81a8b8ff76a676c /flow.c
parenta27bfb381d907ce24163394d01ff2d979404000f (diff)
downloadsparse-dev-92fc6dac2eb886d048d215d2dd4f4f0aada4635e.tar.gz
fix accesses through incorrect union members
No functional change - ->src1 and ->phi_src are at the same offset and have the same type. Discovered and debugged by compiling with "-Dunion=struct" in CFLAGS, which I originally did because I wanted to easily see in GDB which union fields I'm supposed to be accessing. Amazingly, running with -Dunion=struct seems to work pretty well if you patch dup_token() to copy all the union members. Signed-off-by: Jann Horn <jannh@google.com> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'flow.c')
-rw-r--r--flow.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/flow.c b/flow.c
index 5f7054cd..75f47f7e 100644
--- a/flow.c
+++ b/flow.c
@@ -443,9 +443,9 @@ void rewrite_load_instruction(struct instruction *insn, struct pseudo_list *domi
* Check for somewhat common case of duplicate
* phi nodes.
*/
- new = first_pseudo(dominators)->def->src1;
+ new = first_pseudo(dominators)->def->phi_src;
FOR_EACH_PTR(dominators, phi) {
- if (new != phi->def->src1)
+ if (new != phi->def->phi_src)
goto complex_phi;
new->ident = new->ident ? : phi->ident;
} END_FOR_EACH_PTR(phi);