[Bug libfortran/49885] New: Segmentation fault when writing to an automatic character array

mathewc at nag dot co.uk gcc-bugzilla@gcc.gnu.org
Thu Jul 28 10:58:00 GMT 2011


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

           Summary: Segmentation fault when writing to an automatic
                    character array
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: mathewc@nag.co.uk


> uname -a
Linux tiree.nag.co.uk 2.6.27.41-170.2.117.fc10.x86_64 #1 SMP Thu Dec 10
10:36:29 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

> gfortran --version
GNU Fortran (GCC) 4.7.0 20110723 (experimental)

> cat gf.f90
subroutine s(nb)
  integer :: nb
  character (max(80,nb)) :: bad_rec(1)
  write (bad_rec,'(I1)') 0
end
call s(10)
end

> gfortran gf.f90 ; ./a.out
Segmentation fault

Note that the program executes fine if declaration for bad_rec is changed to
any of:

  character (nb) :: bad_rec(1)
  character (max(80,nb)) :: bad_rec



More information about the Gcc-bugs mailing list