------- Comment #3 from raj dot khem at gmail dot com 2010-06-30 21:31 ------- gcc_assert ((!both_p && !fallback_p) 4a7c: 16800004 bnez s4,4a90 <def_builtin_1+0x84> 4a80: 02002021 move a0,s0 4a84: 12c00051 beqz s6,4bcc <def_builtin_1+0x1c0> =================> this jump is taken ============ 4a88: 0080a821 move s5,a0
............. then it comes here libname = name + strlen ("__builtin_"); decl = add_builtin_function (name, fntype, fncode, fnclass, 4bcc: afa00010 sw zero,16(sp) 4bd0: 8fc20070 lw v0,112(s8) 4bd4: afa20014 sw v0,20(sp) 4bd8: 00a02021 move a0,a1 4bdc: 00e02821 move a1,a3 4be0: 02403021 move a2,s2 4be4: 02e03821 move a3,s7 4be8: 8f990000 lw t9,0(gp) 4bec: 0320f809 jalr t9 4bf0: 00000000 nop 4bf4: 8fdc0018 lw gp,24(s8) 4bf8: 080012e8 j 4ba0 <def_builtin_1+0x194> ====================> this jump takes it back to failing assignment 4bfc: 00408821 move s1,v0 .... built_in_decls[(int) fncode] = decl; 4ba0: 00151080 sll v0,s5,0x2 4ba4: 8f830000 lw v1,0(gp) 4ba8: 00621021 addu v0,v1,v0 4bac: ac510000 sw s1,0(v0) ====================> dies here because this is invalid address in v0 now in cases where the first branch is not taken it goes into || !strncmp (name, "__builtin_", strlen ("__builtin_"))); libname = name + strlen ("__builtin_"); decl = add_builtin_function (name, fntype, fncode, fnclass, 4ad4: 0240a821 move s5,s2 4ad8: 00001021 move v0,zero 4adc: 0276100b movn v0,s3,s6 4ae0: afa20010 sw v0,16(sp) 4ae4: 8fc20070 lw v0,112(s8) 4ae8: afa20014 sw v0,20(sp) 4aec: 02002021 move a0,s0 4af0: 02202821 move a1,s1 4af4: 02403021 move a2,s2 4af8: 02e03821 move a3,s7 4afc: 8f990000 lw t9,0(gp) 4b00: 0320f809 jalr t9 4b04: 00000000 nop 4b08: 8fdc0018 lw gp,24(s8) as you can see first instruction moves s2 into s5 and s2 holds the right value so it works ok. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44734