[Bug middle-end/115528] [15 regression] segmentation fault in legacy F77 code since r15-1238-g1fe55a1794863b

kargls at comcast dot net gcc-bugzilla@gcc.gnu.org
Fri Jun 21 05:26:26 GMT 2024


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

--- Comment #20 from kargls at comcast dot net ---
(In reply to Jürgen Reuter from comment #19)
> Created attachment 58476 [details]
> First independent reproducer

It appears to be a striding issue.  The loops at formf.f:507 is

       DO 206 I=1,4
          DO 206 J=1,4
             ! print *, "hadcur(i) before= ", hadcur(i)
             HADCUR(I)=
     $            HADCUR(I)+CMPLX(FIX*COEF1)*FORM1*AA(I,J) !*(PP(K,J)-PP(4,J))
             ! print *, "hadcur(i) after = ", hadcur(i)
 206   CONTINUE
C --- end of the non omega current (3 possibilities)
 201   CONTINUE

For a Fortran programmer, these loops are backwards.  If you do 

       DO 206 J=1,4
          DO 206 I=1,4
             ! print *, "hadcur(i) before= ", hadcur(i)
             HADCUR(I)=
     $            HADCUR(I)+CMPLX(FIX*COEF1)*FORM1*AA(I,J) !*(PP(K,J)-PP(4,J))
             ! print *, "hadcur(i) after = ", hadcur(i)
 206   CONTINUE
C --- end of the non omega current (3 possibilities)
 201   CONTINUE

the code compiles and executes after fixing the same issue near line 599.


More information about the Gcc-bugs mailing list