This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/51643] Incorrect code produced for tail-call of weak function with -O2/-O3 option
- From: "sipych at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Dec 2011 23:33:06 +0000
- Subject: [Bug target/51643] Incorrect code produced for tail-call of weak function with -O2/-O3 option
- Auto-submitted: auto-generated
- References: <bug-51643-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51643
--- Comment #6 from Alexander Osipenko <sipych at gmail dot com> 2011-12-20 23:33:06 UTC ---
It seems reasonable to expect minimal consistency, either generating invalid
(zero for example) reference for any direct weak function call, better marking
it with "warning" or even "error" message, or not depending on the optimization
options.
In any case, the semantics of weak referencies is beyond of the C standard
scope,
so even "if( wfunc ) wfunc();" may be treated only in terms of reasonable
consistency.
EABI specification follows a simple rule: "call to undefined weak function do
nothing".
Just the same do "if( wfunc ) wfunc();", a little bit longer, if we believe
that undefined wfunc == 0 always, but not 0xDEADBEEF eventually when optimized.