public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18411] New: Warning not legitimate
@ 2004-11-09 23:23 manus at eiffel dot com
  2004-11-09 23:29 ` [Bug c/18411] " pinskia at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: manus at eiffel dot com @ 2004-11-09 23:23 UTC (permalink / raw)
  To: gcc-bugs

I'm getting the following compilation warning output:

gcc -c a.c -save-temps
a.c: In function `g':
a.c:8: warning: function called through a non-compatible type
a.c:8: note: if this code is reached, the program will abort

while compiling the following code (content of a.i):

# 1 "a.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "a.c"
extern void f();

void g(char a) {
  void * fnptr = f;

  ((void (*) (char)) fnptr) (a);

  ((void (*) (char)) f)(a);
}

It reports a warning when using `f' but not when using `fnptr'. This is rather
strange and not expected.

Why is it so?

gcc --version is:
gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

and was compiled on a AMD64 machine using Linux Fedora Core 3 for x86_64:
uname -a
Linux madrid.ise 2.6.9-1.667 #1 Tue Nov 2 14:50:10 EST 2004 x86_64 x86_64 
x86_64 GNU/Linux

Thanks,
Manu

-- 
           Summary: Warning not legitimate
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: manus at eiffel dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18411


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2005-07-04  1:38 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-09 23:23 [Bug c/18411] New: Warning not legitimate manus at eiffel dot com
2004-11-09 23:29 ` [Bug c/18411] " pinskia at gcc dot gnu dot org
2004-11-09 23:32 ` manus at eiffel dot com
2004-11-09 23:34 ` manus at eiffel dot com
2004-11-09 23:48 ` joseph at codesourcery dot com
2004-11-09 23:51 ` pinskia at gcc dot gnu dot org
2004-11-10  0:42 ` manus at eiffel dot com
2004-11-10  0:48 ` pinskia at gcc dot gnu dot org
2004-11-10  0:59 ` manus at eiffel dot com
2004-11-10  1:15 ` joseph at codesourcery dot com
2004-11-10  1:25 ` manus at eiffel dot com
2004-11-10  1:26 ` pinskia at gcc dot gnu dot org
2004-11-10  1:41 ` joseph at codesourcery dot com
2004-11-11 20:04 ` manus at eiffel dot com
2005-07-04  1:38 ` SebastianR at gmx dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).