This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/70064] [6 Regression] wrong code with custom flags and quite big testcase @ i686


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

UroÅ Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #2 from UroÅ Bizjak <ubizjak at gmail dot com> ---
Hohum, the problem here is where following asm part is positioned:

        call    __x86.get_pc_thunk.bx   # 263   set_got [length = 12]
        addl    $_GLOBAL_OFFSET_TABLE_, %ebx

If these two insns are positioned as in the attached assembly, we get:

$ gcc -m32 pr70064.s
$ ./a.out
0000318f9e133088
Aborted (core dumped)

But moving insns to the beginning of the assembly, like:

--- pr70064.s   2016-03-03 22:57:32.576740271 +0100
+++ pr70064_.s  2016-03-03 23:20:27.579594191 +0100
@@ -18,6 +18,8 @@
        pushl   %ebx    # 623   *pushsi2        [length = 1]
        .cfi_def_cfa_offset 20
        .cfi_offset 3, -20
+       call    __x86.get_pc_thunk.bx   # 263   set_got [length = 12]
+       addl    $_GLOBAL_OFFSET_TABLE_, %ebx
        subl    $340, %esp      # 624   pro_epilogue_adjust_stack_si_add/1      
        .cfi_def_cfa_offset 360
        movl    364(%esp), %eax # 4     *movsi_internal/1       [length = 7]
@@ -48,8 +50,6 @@
        movl    384(%esp), %ecx # 639   *movsi_internal/1       [length = 7]
        movl    %edi, -56(%esp) # 282   *movsi_internal/2       [length = 4]
        movl    388(%esp), %edi # 460   *movsi_internal/1       [length = 7]
-       call    __x86.get_pc_thunk.bx   # 263   set_got [length = 12]
-       addl    $_GLOBAL_OFFSET_TABLE_, %ebx
        negl    %esi    # 461   *negsi2_cmpz    [length = 2]
        adcl    $0, %edi        # 462   addsi3_carry/1  [length = 3]
        negl    %edi    # 463   *negsi2_1       [length = 2]

the test passes:

$ gcc -m32 pr70064_.s
$ ./a.out
0000318f9e1392ce

I have checked that neither ebx is clobbered, nor flags chain is broken by the
above two insns, so I really fail to see where and if compiler is at fault. 

Binutils bug maybe?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]