]> The Tcpdump Group git mirrors - libpcap/commitdiff
[optimizer] Fix optimizer bug in dead store removal
authorArchit Shah <[email protected]>
Fri, 16 Oct 2020 23:52:39 +0000 (23:52 +0000)
committerGuy Harris <[email protected]>
Sun, 21 Jan 2024 22:45:49 +0000 (14:45 -0800)
Fix opt_deadstores in the optimizer to update the block val data structure with VAL_UNKNOWN when NOP'ing a dead store instruction. Otherwise, a successor block may assume that value is still available. See test case here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=144325.

optimize.c

index 4115cb55dc81f1a552504ebd3f2c5e692a631d79..215f2c98e113985f6071d6458700e5f9fb5e21c7 100644 (file)
@@ -1458,6 +1458,7 @@ opt_deadstores(opt_state_t *opt_state, register struct block *b)
                         */
                        opt_state->non_branch_movement_performed = 1;
                        opt_state->done = 0;
+                       vstore(0, &b->val[atom], VAL_UNKNOWN, 0);
                }
 }