https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110091
--- Comment #12 from Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #11) > (In reply to Andrew Pinski from comment #10) > > because we dont have a marker that starts the storage . > > The storage is started when the address is taken or a store happens to it. > > The above ir can happen via unrolling even. OK, that explains the decision to run this before unrolling, from the implementation: /* Check for dangling pointers in the earliest runs of the pass. The latest point -Wdangling-pointer should run is just before loop unrolling which introduces uses after clobbers. Most cases can be detected without optimization; cases where the address of the local variable is passed to and then returned from a user- defined function before its lifetime ends and the returned pointer becomes dangling depend on inlining. */ Is it possible for uses to appear after CLOBBERs before unrolling too? > Checkout cfgexpand.cc and add_scope_conflicts* functions for how the part of > GCC that is used for correctness implements that. Thanks, I'll take a look.
