https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89337
Rafael Avila de Espindola <rafael at espindo dot la> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |UNCONFIRMED Resolution|DUPLICATE |--- --- Comment #8 from Rafael Avila de Espindola <rafael at espindo dot la> --- The previous testcase passes on trunk, but the original doesn't. The original has a "if (boost::algorithm::ends_with(name, "%2A"))" instead of a direct "if(name.size() > 3)". The reduced testcase uses a find to avoid boost::algorithm and keep the testcase size sane. In the end it seems that gcc is doing an heroic effort to understand the code and issue an warning if it can't prove that the bogus memset is not reached. I don't think that is workable in practice (for sure not in theory): There is always something that is obvious to the developer but not to gcc. IMHO gcc should be issuing warnings only when it shows that a statement can be reached, not when it fails to show the statement cannot be reached.