I've submitted this bug more than 1 year ago at https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=163306. Now I can supply new information: I just confirmed that the bug still exists in latest official release version 4.1.1 as well as in a gcc trunk build from today "gcc (GCC) 4.2.0 20060729 (experimental)". Had I realised last year that this is a problem in the compiler per se and not in any GNU/Linux distribution, I would have probably entered the bug here in the first place.
I copy / paste here from the other URL. Note that there are existing comments there. How reproducible: Always Steps to Reproduce: 1. Compile the program #include <stdio.h> #include <netdb.h> int main() { printf("%d", h_errno); return 0; } and the program #include <netdb.h> int main() { h_errno = 0; return 0; } with mudflap enabled, i.e. gcc -fmudflap prog1.c -lmudflap -o prog1 and gcc -fmudflap prog2.c -lmudflap -o prog2 2. Run prog1 and prog2. Actual Results: When prog1 is run, this is what I get: ******* mudflap violation 1 (check/read): time=1121380261.574621 ptr=0xb7eff6b4 size=4 pc=0xb7f09322 location=`a.cpp:6 (main)' /usr/lib/libmudflap.so.0(__mf_check+0x44) [0xb7f09322] ./a.out(main+0x81) [0x8048839] /usr/lib/libmudflap.so.0(__wrap_main+0x1d8) [0xb7f0a04e] Nearby object 1: checked region begins 17B after and ends 20B after mudflap object 0x80cb430: name=`errno area' bounds=[0xb7eff6a0,0xb7eff6a3] size=4 area=static check=0r/0w liveness=0 alloc time=1121380261.574591 pc=0xb7f09e0a number of nearby objects: 1 When prog2 is run, the report is similar, but it says "(check/write)", instead of "(check/read)" -- because h_errno is written to. Expected Results: There should have been no violation messages. -- Summary: Reading or assigning global h_errno variable causes a memory violation report Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libmudflap AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vesselinpeev at hotmail dot com GCC host triplet: UNCO Running large program compiled with mudflap abort http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28536