On 2 March 2018 at 22:30, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote: > On 2 March 2018 at 22:18, Luc Van Oostenryck > <luc.vanoostenryck@xxxxxxxxx> wrote: >>> I was wondering if the source of the bugs related to uninitialized var >>> and CSE is this that the CSE doesn't know the value came from garbage. >> >> Once we choose to give value 0 to otherwise unintialized vars, it's >> no more garbage than anything else. It's something very sane to do >> for a 'robust compiler'. >> > > I would prefer that the compiler a) doesn't try to CSE values that are > garbage, and b) it is better to know something is garbage than assign > a value 0. Latter makes the CSE do unexpected things I think. In fact > on detecting that a garbage value is being used somewhere the compiler > should simply stop trying to CSE. In my project, the LLVM backend will > stop compiling as soon as it sees a VOID pseudo. > > BTW Sparse IR tends to be always correct before CSE even when there are uninitialized vars. So by stopping CSE when garbage values are detected we preserve 'correctness' which is far more important than some erroneous optimization that produces meaningless IR. Regards Dibyendu -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html