https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98508
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever confirmed|0 |1 CC| |msebor at gcc dot gnu.org Component|c++ |middle-end Blocks| |24639 Last reconfirmed| |2021-01-05 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- It's possible (and obviously desirable) but difficult in general, which is why it hasn't been done yet. But in this case it shouldn't be hard: the warning is suppressed because the code finds the ASAN_MARK (UNPOISON, &s, 4); call in the IL below, and treats it like any other pass-by-reference call: it assumes that it might write to s and thus initialize it. The "fix" is simple: teach the warning that the .ASAN directive doesn't do that. int main () { int D.2825; { struct S s; try { .ASAN_MARK (UNPOISON, &s, 4); s = s; } finally { .ASAN_MARK (POISON, &s, 4); } } D.2825 = 0; return D.2825; } Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=24639 [Bug 24639] [meta-bug] bug to track all Wuninitialized issues