Hi Thomas,
> Ah, I see what was wrong.
>
> The attached patch should fix this.
it almost did the trick indeed. With the new patch, only two failures
remain:
FAIL: gfortran.dg/flush_1.f90 -O0 execution test
FAIL: gfortran.dg/flush_1.f90 -O1 execution test
FAIL: gfortran.dg/flush_1.f90 -O2 execution test
FAIL: gfortran.dg/flush_1.f90 -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions execution test
FAIL: gfortran.dg/flush_1.f90 -O3 -g execution test
FAIL: gfortran.dg/flush_1.f90 -Os execution test
FAIL: gfortran.dg/newunit_1.f90 -O0 execution test
FAIL: gfortran.dg/newunit_1.f90 -O1 execution test
FAIL: gfortran.dg/newunit_1.f90 -O2 execution test
FAIL: gfortran.dg/newunit_1.f90 -O3 -fomit-frame-pointer -funroll-loops
-fpeel-loops -ftracer -finline-functions execution test
FAIL: gfortran.dg/newunit_1.f90 -O3 -g execution test
FAIL: gfortran.dg/newunit_1.f90 -Os execution test
Program received signal SIGSEGV: Segmentation fault - invalid memory reference.
Backtrace for this error:
Segmentation Fault
Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0xfe1b1773 in mutex_lock_impl () from /lib/libc.so.1
(gdb) where
#0 0xfe1b1773 in mutex_lock_impl () from /lib/libc.so.1
#1 0xfe1b1a03 in pthread_mutex_lock () from /lib/libc.so.1
#2 0xfe5d1da4 in __gthread_mutex_lock (__mutex=0x18)
at ../libgcc/gthr-default.h:748
#3 _gfortran_st_flush (fpp=0xfeffda40)
at /vol/gcc/src/hg/trunk/solaris/libgfortran/io/file_pos.c:514
#4 0x0805106f in flush_1 ()
at /vol/gcc/src/hg/trunk/solaris/gcc/testsuite/gfortran.dg/flush_1.f90:11
#5 0x080512a7 in main (argc=1, argv=0xfeffdbfa)
at /vol/gcc/src/hg/trunk/solaris/gcc/testsuite/gfortran.dg/flush_1.f90:28
#6 0x08050de6 in _start ()
I've not yet investigated why they only occur for 32-bit. I tried the
following snippet to fix them
--- libgfortran/io/file_pos.c.save 2018-07-03 22:48:42.485018736 +0000
+++ libgfortran/io/file_pos.c 2018-07-04 07:51:43.494582145 +0000
@@ -511,7 +511,8 @@ st_flush (st_parameter_filepos *fpp)
else
{
needs_unlock = true;
- LOCK (&u->au->io_lock);
+ if (u->au)
+ LOCK (&u->au->io_lock);
}
/* Make sure format buffer is flushed. */
which did so indeed, but now there's another failure, again 32-bit only:
FAIL: gfortran.dg/eof_4.f90 -O0 execution test
FAIL: gfortran.dg/eof_4.f90 -O1 execution test
FAIL: gfortran.dg/eof_4.f90 -O2 execution test
FAIL: gfortran.dg/eof_4.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loo
ps -ftracer -finline-functions execution test
FAIL: gfortran.dg/eof_4.f90 -O3 -g execution test
FAIL: gfortran.dg/eof_4.f90 -Os execution test
At line 12 of file
/vol/gcc/src/hg/trunk/solaris/gcc/testsuite/gfortran.dg/eof_4.f90 (unit = 99)
Fortran runtime error: Cannot open file 'test.dat': File exists
Error termination. Backtrace:
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University