https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66487
--- Comment #16 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #14) > (In reply to Jason Merrill from comment #4) > > Actually, I guess checking for this is more of a fit for an uninitialized > > read detector such as MemorySanitizer or Valgrind memcheck. > > Well, AddressSanitizer should be able to do that too with some extra work, > what we need is know not just when the lifetime of a variable ends, but also > when it starts, and instrument those two, plus disable reusing variable > stack slots when instrumenting. In the function prologue we'd then mark the > variables as unavailable, not just their padding, and then when they get > into scope (that is the first clobber these days), we'd mark them enabled > and when they get out of scope (second clobber) mark them unavailable again. > GCC7 material. Hi Jakub. I've already made a prototype implementation that can do that: https://groups.google.com/forum/#!topic/address-sanitizer/WYdZIo6lnyA It's quite limited to just heap allocation and memory sizes different from multiples of 8B are not correctly handled, but I'm rewriting the patch to prepare it as GCC 7 material. Moreover, Honza suggested that we can use the scaffolding to do a run-time memory aliasing sanitizer that will verify that a memory is accessed just from compatible alias sets. Also GCC 7 material. Martin