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

            Bug ID: 87045
           Summary: pointer to array of character
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: valeryweber at hotmail dot com
  Target Milestone: ---

hi all

i m getting a weird error with the following code.


many thanks

v

cat t2.f90
program test
  character(:), dimension(:), allocatable, target :: t
  character(:), pointer, dimension(:) :: p
  allocate( character(3) :: t(2) )
  t(1) = "abc"
  t(2) = "123"
  write(*,*) t
  p => t
  write(*,*) p(1)
  write(*,*) p(2)
end program test



gfortran-8.1.0 t2.f90 -g -fcheck=all
./a.out 
 abc123
At line 8 of file t2.f90
Fortran runtime error: Unequal character lengths (-3262553545697656832/3) in
pointer assignment

Error termination. Backtrace:
#0  0x402548 in test
        at /home/vwe/work/axv/pkg/build/t2.f90:8
#1  0x402724 in main
        at /home/vwe/work/axv/pkg/build/t2.f90:11

Reply via email to