https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86377
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- In fact <errno.h> is required to define it as a macro in C, and a footnote says: "The macro errno need not be the identifier of an object. It might expand to a modifiable lvalue resulting from a function call (for example, *errno())." Also since 'errno' is reserved as an identifier with external linkage, the declaration in your program has undefined behaviour even if you don't include <errno.h>