https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100352
--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> --- More complete backtrace using reproduction on command line: ... Thread 1 "async_io_1.exe" received signal SIGSEGV, Segmentation fault. __lll_unlock_elision (lock=0x6069d0, private=0) at ../sysdeps/unix/sysv/linux/x86/elision-unlock.c:29 29 _xend(); (gdb) bt #0 __lll_unlock_elision (lock=0x6069d0, private=0) at ../sysdeps/unix/sysv/linux/x86/elision-unlock.c:29 #1 0x00007ffff7b64b03 in __gthread_mutex_unlock (__mutex=0x6069d0) at ../libgcc/gthr-default.h:779 #2 0x00007ffff7b65e5c in _gfortrani_unlock_unit (u=0x6068f0) at /home/vries/gcc_versions/devel/src/libgfortran/io/unit.c:772 #3 0x00007ffff7b6445e in _gfortran_st_write_done (dtp=0x7fffffffd5e0) at /home/vries/gcc_versions/devel/src/libgfortran/io/transfer.c:4496 #4 0x000000000040116a in MAIN__ () #5 0x0000000000401af0 in main () ... OK, se we're hitting this case: unlocking a free lock: ... (gdb) l 24 __lll_unlock_elision(int *lock, int private) 25 { 26 /* When the lock was free we're in a transaction. 27 When you crash here you unlocked a free lock. */ 28 if (*lock == 0) 29 _xend(); 30 else 31 lll_unlock ((*lock), private); 32 return 0; 33 } ...