public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/52615] New: function pointer casting bug
@ 2012-03-19 13:21 cglbftm at gmail dot com
2012-03-19 14:10 ` [Bug c/52615] " rguenth at gcc dot gnu.org
2014-02-05 10:43 ` mpolacek at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: cglbftm at gmail dot com @ 2012-03-19 13:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52615
Bug #: 52615
Summary: function pointer casting bug
Classification: Unclassified
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: cglbftm@gmail.com
gcc compiler can't create any working code for my programm.
Full programm here:
int a(char x)
{
return x;
}
int main()
{
float result;
result = (*(float (*)(double, int, char *))a)(4.5f, 7, "Hello");
return 0;
}
gcc input:
gcc main.c
gcc output:
main.c: In function 'main':
main.c:10:48: warning: function called through a non-compatible type [enabled
by
default]
main.c:10:48: note: if this code is reached, the program will abort
Compiler create executable file. But it doesn't work.
Other compilers(g++, MSVC 10) works fine. No warnings and working programm.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/52615] function pointer casting bug
2012-03-19 13:21 [Bug c/52615] New: function pointer casting bug cglbftm at gmail dot com
@ 2012-03-19 14:10 ` rguenth at gcc dot gnu.org
2014-02-05 10:43 ` mpolacek at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2012-03-19 14:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52615
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jsm28 at gcc dot gnu.org
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-03-19 13:20:36 UTC ---
I believe your program invokes undefined behavior.
But, since 4.7 we can DWIM, the middle-end should be able to handle a local
differing call ABI by means of gimple_call_fntype which can be different from
the type of the FUNCTION_DECL we refer to. I think the only requirement
for the frontends is that the function in the CALL_EXPR is (fntype2 *)&f
with f being of fntype1.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/52615] function pointer casting bug
2012-03-19 13:21 [Bug c/52615] New: function pointer casting bug cglbftm at gmail dot com
2012-03-19 14:10 ` [Bug c/52615] " rguenth at gcc dot gnu.org
@ 2014-02-05 10:43 ` mpolacek at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-02-05 10:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52615
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |mpolacek at gcc dot gnu.org
Resolution|--- |FIXED
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I'd say fixed by r207300.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-05 10:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-19 13:21 [Bug c/52615] New: function pointer casting bug cglbftm at gmail dot com
2012-03-19 14:10 ` [Bug c/52615] " rguenth at gcc dot gnu.org
2014-02-05 10:43 ` mpolacek at gcc dot gnu.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).