http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47037

--- Comment #1 from Changpeng Fang <changpeng.fang at amd dot com> 2010-12-22 
00:55:35 UTC ---
Initially I thought it is a glibc bug, but seems it is not:

(1) A workaround flag is -fno-caller-saves
(2) The compile binary (NOTE: with -static) runs correctly on other systems

The bad code is in atom.fppized:

 subroutine set_label_and_atomic_number(self,label)
    type(atom_type) :: self
    !Set an type(atom_type) "label" and extract the atomic number from it.
      character(*) :: label
      integer(kind=kind(1)) :: lensym,z
      character(128) :: symbol
      logical(kind=kind(.true.)) :: error

      self%label = label


The memset is for the label copy:

.LBB633:
        .loc 1 967 0 discriminator 2
        movq    %r13, %rdx
        movq    %rbx, %rsi
        movq    %rsp, %rdi
        call    memcpy
        movl    $128, %edx
        leaq    (%rsp,%r13), %rdi ## <---- bad address
        movl    $32, %esi
        subq    %r13, %rdx
        movq    %rsp, %r12
        call    memset
        jmp     .L707
.LVL646:
        .p2align 4,,10
        .p2align 3
.L717:


Looks like %rsp value is not correct (stack corrupted).

Reply via email to