[Bug target/53853] FAIL: g++.dg/other/pr53811.C -std=gnu++* (internal compiler error)

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 6 07:45:00 GMT 2012


--- Comment #5 from Uros Bizjak <ubizjak at gmail dot com> 2012-07-06 07:45:21 UTC ---
We can leave all the magic to legitimize_pic_address, so following alternative
patch is much clearer:

--cut here--
Index: i386.c
--- i386.c      (revision 189310)
+++ i386.c      (working copy)
@@ -33057,6 +33057,10 @@ x86_output_mi_thunk (FILE *file,
     emit_jump_insn (gen_indirect_jump (fnaddr));
+      if (flag_pic && SYMBOLIC_CONST (fnaddr))
+       fnaddr = legitimize_pic_address (fnaddr,
+                                        gen_rtx_REG (Pmode, tmp_regno));
       if (!sibcall_insn_operand (fnaddr, word_mode))
          tmp = gen_rtx_REG (word_mode, tmp_regno);
--cut here--

With this patch, we get:

        .size   _ZN1D4foo2Ev, .-_ZN1D4foo2Ev
        .set    .LTHUNK0,_ZN1D4foo2Ev
        .p2align 4,,15
        .globl  _ZThn16_N1D4foo2Ev
        .type   _ZThn16_N1D4foo2Ev, @function
        subq    $16, %rdi
        movabsq $.LTHUNK0@GOTOFF, %r10
        addq    %rbx, %r10
        jmp     *%r10
        .size   _ZThn16_N1D4foo2Ev, .-_ZThn16_N1D4foo2Ev

So, load off GOTOFF table, which works as well.

More information about the Gcc-bugs mailing list