On Tue, Sep 11, 2012 at 2:15 AM, Aurelien Buhrig <aurelien.buhrig.gcc@xxxxxxxxx> wrote: > > > >> Hi, >> >> The gcc.c-torture/execute/nestfunc-3.c test fails on a private target. I >> suspect this is because the STATIC_CHAIN_REGNUM, which is not a call >> used register, is used by the caller function (main), modified by the >> trampoline, but not restored upon nested function return. >> >> Should the STATIC_CHAIN_REGNUM be defined so that >> CALL_USED_REGISTERS[STATIC_CHAIN_REGNUM] == 0? > > The question is rather: > Should the STATIC_CHAIN_REGNUM be defined so that > CALL_USED_REGISTERS[STATIC_CHAIN_REGNUM] == 1? Or is it possible to make > nested functions work if CALL_USED_REGISTERS[STATIC_CHAIN_REGNUM] == 0? The static chain register is normally a call-used register or a fixed register or a stack location. It may be possible to make it work with a call-saved register, but clearly it is essential that the call to the nested function restore the original value of the register before returning. Ian