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

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #7 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Created attachment 46016
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46016&action=edit
Assembly for test case

Looking at the assembly of the test case in comment #6 (with -g -fverbose-asm
only):

.LBE2:
# a.f90:29:       a = a + 1
        .loc 1 29 0
        movl    (%rbx), %eax    # CHAIN.4_10(D)->a, _11
        addl    $1, %eax        #, _12
        movl    %eax, (%rbx)    # _12, CHAIN.4_10(D)->a

When called through a procedure pointer, rbx no longer contains the
address of a.

Looking further up, we have

        movq    %r10, %rbx      # CHAIN.4, CHAIN.4
        movq    %r10, -552(%rbp)        # CHAIN.4,
.LBB2:

so %r10 is clobbered. This happens in the call of _gfortran_st_write.

Looking at the ABI, %r10 is not supposed to be preserved.

Data point: This works on POWER9.

This looks like a target bug to me.

Reply via email to