https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68767
--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Jorn Wolfgang Rennecke from comment #3) > (In reply to Manuel López-Ibáñez from comment #2) > > I don't understand. It is indeed passing NULL to a non-null function. What > > is wrong with the warning? > > When you look at the original testcase closely, you'll see that it can never > (unless there is a race condition, invoking undefined behaviour) pass NULL. > In fact, it always passes "lstr" . Well, fold_for_warn() is not smart enough to see this, unfortunately. Optimizations in the middle-end do, but this is too late for the warning and only works with -O1 or higher. Either we make fold_for_warn() smarter or you work-around the warning (use "" instead of 0 or separate the argument into a different statement).