Bug 118911 - gcc warning without reason
Summary: gcc warning without reason
Status: VERIFIED FIXED
Alias: None
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: Development (show other bugs)
Version: RC 1
Hardware: x86 Linux
: P5 - None : Normal
Target Milestone: ---
Assignee: Michael Matz
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-26 20:31 UTC by Jan Engelhardt
Modified: 2006-07-15 09:30 UTC (History)
1 user (show)

See Also:
Found By: Beta-Customer
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
testcase (451 bytes, application/octet-stream)
2005-09-26 20:31 UTC, Jan Engelhardt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Engelhardt 2005-09-26 20:31:06 UTC
Compile attached file -- no special flags needed, gcc mx.c, and I get the error

mx.c: In function ■fail■:
mx.c:10: warning: assignment discards qualifiers from pointer target type

It does not happen with the other two functions which are equivalent.

22:30 shanghai:~ > rpm -q gcc
gcc-4.0.2_20050901-3
Comment 1 Jan Engelhardt 2005-09-26 20:31:37 UTC
Created attachment 50861 [details]
testcase

gcc -c mx.c

No linking needed.
Comment 2 Marcus Meissner 2005-09-27 07:54:41 UTC
well, the whole struct is passed marked as const, so probably the field 
are considered const too. 
Comment 3 Michael Matz 2005-10-04 14:59:31 UTC
This warning indeed is invalid (Marcus: the field itself is indeed considered 
const, but that doesn't mean that the pointed-to memory is readonly, i.e. 
the type of c->var in this context is "char * const var", but not 
"const char *". ) 
 
This is meanwhile fixed in 4.1 which doesn't give the wrong warning anymore. 
There are no plans to backport this specifically to 4.0, so I'll close 
this as FIXED.