[Bug c/59905] Unfriendly abort when calling a fucntion via a function pointer cast

2023-05-12 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59905

Andrew Pinski  changed:

   What|Removed |Added

   Target Milestone|--- |4.9.0

[Bug c/59905] Unfriendly abort when calling a fucntion via a function pointer cast

2014-01-30 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59905

--- Comment #3 from Richard Biener rguenth at gcc dot gnu.org ---
Author: rguenth
Date: Thu Jan 30 14:17:02 2014
New Revision: 207300

URL: http://gcc.gnu.org/viewcvs?rev=207300root=gccview=rev
Log:
2014-01-30  Richard Biener  rguent...@suse.de

PR c/59905
* c-typeck.c (build_function_call_vec): Do not replace calls
to a function via an incompatible type with a runtime abort.

* gcc.dg/cast-function-1.c: Adjust to survive DCE.
* gcc.dg/call-diag-2.c: Remove expected warnings about calling
abort.
* gcc.dg/invalid-call-1.c: Likewise.

Modified:
trunk/gcc/c/ChangeLog
trunk/gcc/c/c-typeck.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.dg/call-diag-2.c
trunk/gcc/testsuite/gcc.dg/cast-function-1.c
trunk/gcc/testsuite/gcc.dg/invalid-call-1.c


[Bug c/59905] Unfriendly abort when calling a fucntion via a function pointer cast

2014-01-30 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59905

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||4.9.0
 Resolution|--- |FIXED

--- Comment #4 from Richard Biener rguenth at gcc dot gnu.org ---
Fixed for 4.9.


[Bug c/59905] Unfriendly abort when calling a fucntion via a function pointer cast

2014-01-29 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59905

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2014-01-29
   Assignee|unassigned at gcc dot gnu.org  |rguenth at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener rguenth at gcc dot gnu.org ---
We have a nicer way now - let me have a look.


[Bug c/59905] Unfriendly abort when calling a fucntion via a function pointer cast

2014-01-29 Thread rguenth at gcc dot gnu.org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59905

--- Comment #2 from Richard Biener rguenth at gcc dot gnu.org ---
Created attachment 31977
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=31977action=edit
patch

I am testing the following.  The middle-end now properly calls a function via
the ABI as specified by the function type used for the indirect call and the
inliner refrains from inlining function with too much mismatch.  If that
doesn't
end up working we have to fix that (I positively believe it does work).

Btw, a workaround for you is to simply go through a temporary:

#define bar_get_x \
  ({ bar_get_x_func *f = (bar_get_x_func*) foo_get_x; f; })

that way the frontend doesn't detect the mismatch and thus simply emits
an indirect call (later optimized to a direct one).