public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/44586] New: gcc does not warn about casting non-variadic types to variadic types
@ 2010-06-18 19:48 raj dot khem at gmail dot com
2010-06-20 21:41 ` [Bug c/44586] " manu at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: raj dot khem at gmail dot com @ 2010-06-18 19:48 UTC (permalink / raw)
To: gcc-bugs
the folowing testcase does a casting which results in undefined behaviour but
gcc does not warn about it.
ypedef int (*bar_t)(int x, int y, ...);
int foo(int x, int y) {
return x+y;
}
void f(int x, int y) {
bar_t bar;
/* Cast foo to variadic type... undefined behaviour */
bar = (bar_t) foo;
(*bar)(x,y);
}
--
Summary: gcc does not warn about casting non-variadic types to
variadic types
Product: gcc
Version: 4.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: raj dot khem at gmail dot com
GCC build triplet: x86_64-linux-gnu
GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44586
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/44586] gcc does not warn about casting non-variadic types to variadic types
2010-06-18 19:48 [Bug c/44586] New: gcc does not warn about casting non-variadic types to variadic types raj dot khem at gmail dot com
@ 2010-06-20 21:41 ` manu at gcc dot gnu dot org
2010-06-20 22:17 ` joseph at codesourcery dot com
2010-06-20 22:25 ` manu at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-20 21:41 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from manu at gcc dot gnu dot org 2010-06-20 21:41 -------
Joseph, what do you think? Any suggestions where this may be catched? wording?
option?
I have wished for some time to create a -Wundefined option anyway.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org,
| |jsm28 at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44586
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/44586] gcc does not warn about casting non-variadic types to variadic types
2010-06-18 19:48 [Bug c/44586] New: gcc does not warn about casting non-variadic types to variadic types raj dot khem at gmail dot com
2010-06-20 21:41 ` [Bug c/44586] " manu at gcc dot gnu dot org
@ 2010-06-20 22:17 ` joseph at codesourcery dot com
2010-06-20 22:25 ` manu at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: joseph at codesourcery dot com @ 2010-06-20 22:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from joseph at codesourcery dot com 2010-06-20 22:17 -------
Subject: Re: gcc does not warn about casting non-variadic types
to variadic types
It's not the conversion that's undefined, but the call. You could have an
option to warn for all function pointer conversions to incompatible
function pointer types (but they have reasonable uses as there isn't a
generic function pointer type like void *) - or you could have the
optimizers detect calls to incompatibly cast types and warn then like the
front ends does when the cast appears directly in the call.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44586
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/44586] gcc does not warn about casting non-variadic types to variadic types
2010-06-18 19:48 [Bug c/44586] New: gcc does not warn about casting non-variadic types to variadic types raj dot khem at gmail dot com
2010-06-20 21:41 ` [Bug c/44586] " manu at gcc dot gnu dot org
2010-06-20 22:17 ` joseph at codesourcery dot com
@ 2010-06-20 22:25 ` manu at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-20 22:25 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from manu at gcc dot gnu dot org 2010-06-20 22:25 -------
OK. So I would say confirmed, but still I am not sure how I would implement
this. So patches welcome.
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-06-20 22:25:41
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44586
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-20 22:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-18 19:48 [Bug c/44586] New: gcc does not warn about casting non-variadic types to variadic types raj dot khem at gmail dot com
2010-06-20 21:41 ` [Bug c/44586] " manu at gcc dot gnu dot org
2010-06-20 22:17 ` joseph at codesourcery dot com
2010-06-20 22:25 ` manu at gcc dot gnu dot org
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).