https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101830
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |FIXED --- Comment #12 from Martin Sebor <msebor at gcc dot gnu.org> --- No problem. By the way, it looks to me like safe_inc_pos() also isn't entirely safe since testing the result of the postincrement lets pos reach 1024 on function return. It should either use preincrement or 1023 as the bound. It's of course possible to issue a more nuanced warning ("may be out of bounds") for expressions that are invalid only under some condition, in basic blocks that aren't dominated by function entry. It has been suggested (and considered) a number of times before. The problem with a simplistic solution like that is that it would result in the vast majority of warnings being phrased this way, because most are in such blocks. The only certain warnings would be either in trivial functions or in the initial basic blocks. I'm working on introducing this distinction for PHIs but I don't have any ideas what to do for problems like this one.