-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
Description
- flang version
flang-new version 19.1.4 (https://github.com/conda-forge/clangdev-feedstock ea701dd210fdae63609dff9e817128a8f9847256)
Target: x86_64-conda-linux-gnu
Thread model: posix
InstalledDir: /home/xxx/miniconda3/envs/lf/bin
Configuration file: /home/xxx/miniconda3/envs/lf/bin/x86_64-conda-linux-gnu.cfg
flang will give the wrong result if len of s is smaller than input data
- the code
program main
implicit none
character(len=1)::s(2)
read(*,*)s
print*,s(1)
print*,s(2)
end program main$ gfortran 1.f90 && ./a.out
ab cd
a
c
$ flang-new 1.f90 && ./a.out
ab cd
a
bif len of s is greater equal than input data
program main
implicit none
character(len=3)::s(2)
read(*,*)s
print*,s(1)
print*,s(2)
end program main$ gfortran 1.f90 && ./a.out
ab cd
ab
cd
$ flang-new 1.f90 && ./a.out
ab cd
ab
cd