https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10837

--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Richard Henderson from comment #2)
> Working as designed.
> (1) It often takes more insns to pop the stack frame than to make the call.
> (2) You get a proper backtrace from abort.
> (3) http://gcc.gnu.org/ml/gcc-patches/2000-10/msg00180.html

Glibc has been using

ENTRY (__memmove_chk)
        movl    12(%esp), %eax
        cmpl    %eax, 16(%esp)
        jb      __chk_fail
        jmp     memmove
END (__memmove_chk)

since 2004. #1 and #2 shouldn't be the reason not to optimize.  I
am using:

/* Due to
   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=10837
   noreturn attribute disable tail call optimization.  Removes noreturn
   attribute to enable tail call optimization.  */
extern void *chk_fail (void) __asm__ ("__chk_fail") attribute_hidden;

to work around this.

Reply via email to