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

            Bug ID: 127823
           Summary: valgrind error in traverse_io_block(gfc_code*, bool*,
                    gfc_code*) (fron tend-passes.cc:1239)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For this code from the Fujitsu Fortran test suite on github.com:

PROGRAM MAIN

COMPLEX::OBJW(5)
REAL::R1(5),R2(5)
 INTEGER::G,F,Y,S,K,J,I,R
OBJW=(3.44,8.44)

 OPEN (UNIT=71, FILE='fort.79', FORM='UNFORMATTED')
WRITE(UNIT=71)
((((((((OBJW(I)%RE,I=1,2),J=1,2),K=1,2),S=1,2),R=1,2),Y=1,2),F=1,
2),G=1,2)
WRITE(UNIT=71)
((((((((OBJW(I)%IM,I=1,2),J=1,2),K=1,2),S=1,2),R=1,2),Y=1,2),F=1,
2),G=1,2)
     CLOSE (UNIT=71)

OPEN (UNIT=77, FILE='fort.79', FORM='UNFORMATTED')
READ(UNIT=77)
((((((((R1(I),I=1,2),J=1,2),K=1,2),S=1,2),R=1,2),Y=1,2),F=1,2),G=1
,2)
READ(UNIT=77)
((((((((R2(I),I=1,2),J=1,2),K=1,2),S=1,2),R=1,2),Y=1,2),F=1,2),G=1
,2)
     CLOSE (UNIT=77,status='delete')
IF( R1(2) .ne. 3.44)print*,'101'
IF( R2(2) .ne. 8.44)print*,'102'



 PRINT*,'PASS'

END PROGRAM



the attached code does this:

$  ~/gcc/results.20261009.valgrind/bin/gfortran  -c -w -O1 bug1244.f90
==2354827== Invalid read of size 8
==2354827==    at 0x695AF6: traverse_io_block(gfc_code*, bool*, gfc_code*)
(frontend-passes.cc:1239)
==2354827==    by 0x695ADE: traverse_io_block(gfc_code*, bool*, gfc_code*)
(frontend-passes.cc:1237)
==2354827==    by 0x695ADE: traverse_io_block(gfc_code*, bool*, gfc_code*)
(frontend-passes.cc:1237)
==2354827==    by 0x695ADE: traverse_io_block(gfc_code*, bool*, gfc_code*)
(frontend-passes.cc:1237)
==2354827==    by 0x695ADE: traverse_io_block(gfc_code*, bool*, gfc_code*)
(frontend-passes.cc:1237)
==2354827==    by 0x696370: simplify_io_impl_do(gfc_code**, int*, void*)
(frontend-passes.cc:1454)

It was originally file Fortran/0093/0093_0059.f90.
The line of compiler source code is

    if (curr != stack_top->code && !*has_reached)

Reply via email to