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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
           Keywords|needs-reduction             |
             Status|WAITING                     |ASSIGNED

--- Comment #21 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  We're vectorizing the outer loop here

        do i = 1,4
           do j = 1,4
              HADCUR(I)=
     $            HADCUR(I)+CMPLX(COEF1)*FORM1*AA(I,J)*(PP(K,J)-PP(4,J))
           end do
        end do

and the issue is we're doing

=> 0x00000000006b7218 <+2504>:  movapd 0x0(%r13),%xmm1

on

(gdb) p/x $r13
$2 = 0x7fffffffb5d8

which is an unaligned address.  This is the access to AA.

The following reproduces the issue with -O2 -fno-inline:

      subroutine init(COEF1,FORM1,AA)
      double precision COEF1,X
      double complex FORM1
      double precision AA(4,4)
      COEF1=0
      FORM1=0
      AA=0
      end
      subroutine curr(HADCUR)
      double precision COEF1
      double complex HADCUR(4),FORM1
      double precision AA(4,4)
      call init(COEF1,FORM1,AA)
      do i = 1,4
         do j = 1,4
            HADCUR(I)=
     $         HADCUR(I)+CMPLX(COEF1)*FORM1*AA(I,J)
         end do
      end do
      end
      program test
        double complex HADCUR(4)
        hadcur=0
        call curr(hadcur)
      end

Reply via email to