On 8/22/22 00:16, Richard Biener via Gcc-patches wrote:
The following fixes PR105646, not diagnosing

int f1();
int f3(){
     auto const & a = f1();
     bool v3{v3};
     return a;
}

with optimization because the early uninit diagnostic pass only
diagnoses always executed cases.  The patch does this by
re-interpreting what always executed means and choosing to
ignore exceptional and abnormal control flow for this.  At the
same time it improves things as suggested in a comment - when
the value-numbering run done without optimizing figures there's
a fallthru path, consider blocks on it as always executed.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

OK?

Thanks,
Richard.

        PR tree-optimization/105646
        * tree-ssa-uninit.cc (warn_uninitialized_vars): Pre-compute
        the set of fallthru reachable blocks from function entry
        and use that to determine wlims.always_executed.

        * g++.dg/uninit-pr105646.C: New testcase.

I'm torn on this.  On one hand, ignoring abnormal flow control in the early pass is almost certainly going to result in false positives but it's also going to result in fixing some false negatives.

I'm willing to ACK and see what the real world fallout is in the spring when the distros run their builds.  Your call.


Jeff


Reply via email to