I was a bit surprised to see that "conditions" is not normalized according to var_eqs. Unfortunately, changing this does not fix the issue completely as the mem part still contains v3 and not a2:
Thus, in addition to the previous change, modifying the canonicalization on pre to take into account var_eqs fixes the issue.
However, I am not sure this is the correct way of fixing this issue. When removing the read to range_var, the contradiction is seen later on, when applying the post state. So here Pulse is correct in the sense that only one state remains (range_var_valid = true is correctly discarded). But since Pulse checks the validity/initialization of abstract values before applying the post, the error is recorded before contradiction is discovered.
I will propose a patch with the two changes I described, but I am also very interested about your though on the second part.
In the following cpp reproducer:
Pulse reports an uninitialized value when calling do_stuff for range_var. However, in case range_var_valid is false, range_var is not read.
Here is the summary for do_stuff (when range_var_valid is true):
Let's first zoom on the conditions part:
I was a bit surprised to see that "conditions" is not normalized according to var_eqs. Unfortunately, changing this does not fix the issue completely as the mem part still contains v3 and not a2:
Thus, in addition to the previous change, modifying the canonicalization on pre to take into account var_eqs fixes the issue.
However, I am not sure this is the correct way of fixing this issue. When removing the read to range_var, the contradiction is seen later on, when applying the post state. So here Pulse is correct in the sense that only one state remains (range_var_valid = true is correctly discarded). But since Pulse checks the validity/initialization of abstract values before applying the post, the error is recorded before contradiction is discovered.
I will propose a patch with the two changes I described, but I am also very interested about your though on the second part.