https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61846
--- Comment #5 from Zbigniew Jędrzejewski-Szmek <zbyszek at in dot waw.pl> --- (In reply to Andrew Pinski from comment #4) > C99 also has this requirement. But C89 did not. The warnings are "best effort" anyway. So even if the standards did *not* say that, gcc could skip the warning since existing systems all work this way anyway. I think it could make for a nice optimization, when compiling for C99, but that is not what I'm asking for atm. > >Values for errno are now required to be distinct positive values rather than > > non-zero values. This change is for alignment with the ISO/IEC 9899:1999 > > standard. > > So using -std=gnu99 should allow this to not be unitilaized except GCC has > no way to know you are reading from errno just yet. Wouldn't it be a matter of annotating read() call with the sideffect of "return value >= 0 || errno > 0" ?