Subject: Re: Global variable name which equals to func name causes coredump(gcc).
To: Greg Troxel <>
From: Pelle Johansson <>
List: tech-userlevel
Date: 09/27/2007 14:16:04
27 sep 2007 kl. 13.49 skrev Greg Troxel:

>   Obviously fread called the wrong func address of read.
> To answer if this is a bug, I think you'll need to read the C standard
> very carefully.  read(2) is not part of C; man 2 read says it's in  
> POSIX.1.
> But fread is part of C89.

Which indicates that it is indeed a bug, and probably one not that  
difficult to fix, by having fread call some alias of read instead. Of  
course, it gets more complicated when the same has to be done for all  
possible conflicts.
The second example is not as clearly a bug. I would argue that you're  
simply not allowed to have a local symbol called mlock if you want to  
use the pthread library. I don't know what POSIX says on the issue  
specifically though.
Pelle Johansson