Bug 151152 - string.h seems to be broken
string.h seems to be broken
Product: Fedora
Classification: Fedora
Component: gcc4 (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2005-03-15 09:15 EST by Paul F. Johnson
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-03-15 10:03:46 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Source file causing the problems (18.16 KB, text/plain)
2005-03-15 09:15 EST, Paul F. Johnson
no flags Details
Error report from compilation (2.37 KB, text/plain)
2005-03-15 09:18 EST, Paul F. Johnson
no flags Details

  None (edit)
Description Paul F. Johnson 2005-03-15 09:15:43 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):

How reproducible:

Steps to Reproduce:
1. Download from svn libgdiplus
2. ./autogen.sh; make
Actual results:
See attachment, it fails to compile

Expected results:
Compilation should work

Additional info:
Comment 1 Paul F. Johnson 2005-03-15 09:15:43 EST
Created attachment 112017 [details]
Source file causing the problems
Comment 2 Paul F. Johnson 2005-03-15 09:18:05 EST
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).
Comment 3 Jakub Jelinek 2005-03-15 10:03:46 EST
The problem is just that the testcase you provided violates ISO C standards,
nothing else.
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

Note You need to log in before you can comment on or make changes to this bug.