------- Comment #8 from slyfox at inbox dot ru  2009-08-23 11:12 -------
(In reply to comment #7)
> Subject: Bug 40718
> 
> Author: uros
> Date: Sun Aug 23 09:46:00 2009
> New Revision: 151028
> 
> URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151028
> Log:
>         PR target/40718
>         * config/i386/i386.c (*call_pop_1): Disable for sibling calls.
>         (*sibcall_pop_1): New insn pattern.
> 
> testsuite/ChangeLog:
> 
>         PR target/40718
>         * gcc.target/i386/pr40718.c: New test.
> 
> 
> Added:
>     trunk/gcc/testsuite/gcc.target/i386/pr40718.c
> Modified:
>     trunk/gcc/ChangeLog
>     trunk/gcc/config/i386/i386.md
>     trunk/gcc/testsuite/ChangeLog
> 

This patch fixes for me Dmitry's sample, but does not fix mine. Still SIGSEGVs.
I've managed to
place whole testcase in one file:

$ g++ -O1 -foptimize-sibling-calls -m32 -DCALLTYPE="__attribute__((stdcall))"
main.cc -o show_the_bug 
$ ./show_the_bug
Segmentation fault
$ cat main.cc 
#define CALLTYPE __attribute__((stdcall))

struct Base {
    virtual unsigned long CALLTYPE base_do1(unsigned long, unsigned long)
__attribute__((noinline))
    {
        return 4;
    }
};

static Base bi;
Base * glo_ptr_to_base = &bi;

struct Stuff {
    void CALLTYPE do_stuff(unsigned long param1, unsigned long param2)
__attribute__((noinline))
    {
        if (param1 == 0xFFFFFFFE)
        {
            return;
        }
        glo_ptr_to_base->base_do1(param1, param2);
    }
};

int
main()
{
    Stuff o;
    o.do_stuff(1, 32);
    return 0;
}

-----------------------------------------------
_ZN5Stuff8do_stuffEmm:
.LFB1:
        .cfi_startproc
        .cfi_personality 0x0,__gxx_personality_v0
        pushl   %ebp
        .cfi_def_cfa_offset 8
        movl    %esp, %ebp
        .cfi_offset 5, -8
        .cfi_def_cfa_register 5
        pushl   %ebx
        subl    $4, %esp
        movl    12(%ebp), %eax
        cmpl    $-2, %eax
        je      .L5
        .cfi_offset 3, -12
        movl    glo_ptr_to_base, %edx
        movl    %edx, 8(%ebp)
        movl    -4(%ebp), %ebx
        leave
        jmp     *(%ebx)
.L5:
        movl    -4(%ebp), %ebx
        leave
        ret     $12
        .cfi_endproc


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40718

Reply via email to