Bug 151152 - string.h seems to be broken
Summary: string.h seems to be broken
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc4
Version: rawhide
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-03-15 14:15 UTC by Paul F. Johnson
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-03-15 15:03:46 UTC
Type: ---
Embargoed:


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

Description Paul F. Johnson 2005-03-15 14:15:43 UTC
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):
gcc-4.0.0.0-0.33

How reproducible:
Always

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

Expected results:
Compilation should work

Additional info:

Comment 1 Paul F. Johnson 2005-03-15 14:15:43 UTC
Created attachment 112017 [details]
Source file causing the problems

Comment 2 Paul F. Johnson 2005-03-15 14:18:05 UTC
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 15:03:46 UTC
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:
http://gcc.gnu.org/ml/gcc-patches/2004-07/msg01284.html
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
strcmp.


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