Red Hat Bugzilla – Bug 151152
string.h seems to be broken
Last modified: 2007-11-30 17:11:01 EST
Description of problem:
I'm compiling libdgiplus from the mono svn repository. One of the source files
fails to compile. If I change font.c (line 283) to read
if strcmp((unsigned char*)string,(unsigned char*) str)...
and attempt to recompile, the warnings about the signed in strcmp are removed,
but remain for strlen (which is not referenced in that line at all, which makes
me suspect a problem with gcc rather than the source)
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Download from svn libgdiplus
2. ./autogen.sh; make
See attachment, it fails to compile
Compilation should work
Created attachment 112017 [details]
Source file causing the problems
Created attachment 112018 [details]
Error report from compilation
Throw back from the source code compilation shows that there is a signed
problem in strcmp and strlen. The source code maintains that the arguments
being passed in are unsigned char* (the variables are of that type).
The problem is just that the testcase you provided violates ISO C standards,
Older GCC versions were warning (resp. erroring out) on this just with
-pedantic, now this warning is on by default, see:
It can be turned off with -Wno-pointer-sign, but it is better to actually
fix the code.
The reason why you get warnings about strlen etc. is that optimized strcmp
in <bits/string2.h> is implemented as a #define that uses strlen etc. internally.
If you compile with -O0 or -D__NO_STRING_INLINES, you get the warning just about