Open Beliavsky opened 3 years ago
Firstly, I tried to run fpm test
on my laptop (windows 10, msys2-gfortran 10.3), and there was no failure.
And I tried the gcc12 provided by equation.com, and it did get errors. It seems to be a bug with the gcc12 provided by equation.com!
When loadtxt
reads a real(qp) array from a file, an error may be reported, because of an uncertain bug about reading real(qp) array from files in gcc12 provided by equation.com (It does not seem to be any bug of loadtxt
and savetxt
.):
tmp_qp.dat
1.00000000000000000000000000000000000 4.00000000000000000000000000000000000
2.00000000000000000000000000000000000 5.00000000000000000000000000000000000
3.00000000000000000000000000000000000 6.00000000000000000000000000000000000
2. `demo1.f90`
```fortran
program demo
real(16) :: q0, q(2)
open(1, file="tmp_qp.dat")
!> test for qp scalar
read(1, *) q0
print *, q0
!> test for qp array
rewind(1)
read(1, *) q
print *, q
close(1)
end program demo
1.00000000000000000000000000000000000
1.00000000000000000000000000000000000 4.00000000000000000000000000000000000
demo2.f90
Comment out the code to read real(qp) scalar, just keep reading real(qp) array.
program demo
real(16) :: q0, q(2)
open(1, file="tmp_qp.dat")
! !> test for qp scalar
! read(1, *) q0
! print *, q0
! !> test for qp array
! rewind(1)
read(1, *) q
print *, q
close(1)
end program demo
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
4. More Weird 🙃
```fortran
program demo
real(16) :: q0, q(2)
open(1, file="tmp_qp.dat")
! !> test for qp scalar
! read(1, *) q0
print *, q0 !! Difference🔰 here.
! !> test for qp array
! rewind(1)
read(1, *) q
print *, q
close(1)
end program demo
1.68057005478764111801640313826496845E-4932
1.00000000000000000000000000000000000 4.00000000000000000000000000000000000
Gcc12 is still an experimental version, I haven't tested the gcc9~11 provided by equation.com, and I don't know if they also has this problem.
Thanks @zoziha . Could you report this on GCC bugzilla?
Okay, I plan to combine this issue with #532 and try to feed back to gcc. I am registering a gcc feedback account ...
These particular tests test_loadtxt_qp.exe
and test_savetxt_qp.exe
pass, using https://gcc.gnu.org/pub/gcc/snapshots/12-20210905/ on Windows.
Running GNU Fortran (GCC) 12.0.0 20210718 from equation.com on Windows 10, and using fpm
I get
Running the executable manually I get