https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63814

--- Comment #18 from H.J. Lu <hjl.tools at gmail dot com> ---
Igor, Kirill, I confirmed r216154 is the cause of this
bug.  You can checkout both r216153 and r216154.  You build
2 compilers and compare results. You can build a cross
compiler with

.../gcc/configure --enable-languages=c,c++ --disable-bootstrap
--target=x86_64-apple-darwin

you will see ICE.  If you build the native Linux compiler, you
will see run-time failure.  The difference between good and
bad assembly code is

--- good.s    2014-11-14 14:54:54.362696443 -0800
+++ bad.s    2014-11-14 15:12:54.608434347 -0800
@@ -84,12 +84,12 @@ _ZN8CExample9MixinFuncEiPv:
     .weak    _ZThn4_N8CExample9MixinFuncEiPv
     .type    _ZThn4_N8CExample9MixinFuncEiPv, @function
 _ZThn4_N8CExample9MixinFuncEiPv:
-.LFB13:
+.LFB15:
     .cfi_startproc
     subl    $4, 4(%esp)
     jmp    .LTHUNK0
     .cfi_endproc
-.LFE13:
+.LFE15:
     .size    _ZThn4_N8CExample9MixinFuncEiPv,
.-_ZThn4_N8CExample9MixinFuncEiPv
     .section   
.text.unlikely._ZThn4_N8CExample9MixinFuncEiPv,"axG",@progbits,_ZN8CExample9MixinFuncEiPv,comdat
 .LCOLDE2:
@@ -105,20 +105,52 @@ _ZThn4_N8CExample9MixinFuncEiPv:
 _Z4testR6MMixin:
 .LFB11:
     .cfi_startproc
-    subl    $16, %esp
-    .cfi_def_cfa_offset 20
-    movl    20(%esp), %eax
+    pushl    %ebx
+    .cfi_def_cfa_offset 8
+    .cfi_offset 3, -8
+    call    __x86.get_pc_thunk.bx
+    addl    $_GLOBAL_OFFSET_TABLE_, %ebx
+    subl    $8, %esp
+    .cfi_def_cfa_offset 16
+    movl    16(%esp), %eax
     movl    (%eax), %edx
+    movl    (%edx), %edx
+    cmpl    _ZThn4_N8CExample9MixinFuncEiPv@GOT(%ebx), %edx
+    jne    .L10
+    cmpl    $48879, 12(%eax)
+    jne    .L14
+    addl    $8, %esp
+    .cfi_remember_state
+    .cfi_def_cfa_offset 8
+    popl    %ebx
+    .cfi_restore 3
+    .cfi_def_cfa_offset 4
+    ret
+    .p2align 4,,10
+    .p2align 3
+.L10:
+    .cfi_restore_state
+    subl    $4, %esp
+    .cfi_def_cfa_offset 20
     pushl    $0
     .cfi_def_cfa_offset 24
     pushl    $1
     .cfi_def_cfa_offset 28
     pushl    %eax
     .cfi_def_cfa_offset 32
-    call    *(%edx)
-    addl    $28, %esp
+    call    *%edx
+    addl    $16, %esp
+    .cfi_def_cfa_offset 16
+    addl    $8, %esp
+    .cfi_remember_state
+    .cfi_def_cfa_offset 8
+    popl    %ebx
+    .cfi_restore 3
     .cfi_def_cfa_offset 4
     ret
+.L14:
+    .cfi_restore_state
+    call    abort@PLT
     .cfi_endproc
 .LFE11:
     .size    _Z4testR6MMixin, .-_Z4testR6MMixin
@@ -265,11 +297,11 @@ _ZTV8CExample:
     .hidden    __x86.get_pc_thunk.bx
     .type    __x86.get_pc_thunk.bx, @function
 __x86.get_pc_thunk.bx:
-.LFB14:
+.LFB16:
     .cfi_startproc
     movl    (%esp), %ebx
     ret
     .cfi_endproc
-.LFE14:
+.LFE16:
     .ident    "GCC: (GNU) 5.0.0 20141013 (experimental)"
     .section    .note.GNU-stack,"",@progbits

Please find out why PIC register change caused this.

Reply via email to