This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/30743] New: Bogus warning on argument passing discarding qualifiers
- From: "gdr at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Feb 2007 09:28:22 -0000
- Subject: [Bug c/30743] New: Bogus warning on argument passing discarding qualifiers
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following is a testcase distilled from a build failure while compiling
CVS GDB:
/home/gdr/redhat/src/gdb/ada-lang.c: In function 'ada_lookup_symbol_list':
/home/gdr/redhat/src/gdb/ada-lang.c:4659: warning: passing argument 3 of
'remove_out_of_scope_renamings' discards qualifiers from pointer target type
make[2]: *** [ada-lang.o] Error 1
How to repeat:
% cat b.c && gcc -c -O2 -Wall -Werror b.c
struct T { int i; };
static int f(struct T* p) { return p->i; }
int g(const struct T* p) { return f((struct T*)p); }
int main(void)
{
struct T t = {0};
return g(&t);
}
cc1: warnings being treated as errors
b.c: In function 'g':
b.c:6: warning: passing argument 1 of 'f' discards qualifiers from pointer
target type
--
Summary: Bogus warning on argument passing discarding qualifiers
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gdr at gcc dot gnu dot org
GCC host triplet: native build; platform independent
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30743