At any optimisation level other than -O0, it seems that __builtin_eh_return
loses its handler arg.  For -m32 -O2 -S the following:

long offset;
void *handler;

void foo (void)
{
  __builtin_eh_return (offset, handler);
}

compiles to:

foo:
        stwu 1,-32(1)
        lis 9,off...@ha
        mflr 0
        stw 0,36(1)
        stw 3,16(1)
        stw 4,20(1)
        stw 5,24(1)
        stw 6,28(1)
        lwz 10,off...@l(9)
        lwz 0,36(1)
        lwz 3,16(1)
        lwz 4,20(1)
        lwz 5,24(1)
        mtlr 0
        lwz 6,28(1)
        addi 1,1,32
        add 1,1,10
        blr


-- 
           Summary: __builtin_eh_return miscompiled
           Product: gcc
           Version: 4.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: amodra at gmail dot com
GCC target triplet: powerpc*-*-linux


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

Reply via email to