https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88899
--- Comment #1 from martin <mscfd at gmx dot net> --- With sufficiently many threads (at least 5 or 6 for me) the address santizer gives (for gfortran-9, compiled a few weeks ago): ==3485==ERROR: AddressSanitizer: attempting double-free on 0x6020001956d0 in thread T4: #0 0x7f72705a7280 in __interceptor_free (/usr/lib64/libasan.so.5+0xeb280) #1 0x401935 in __mod_MOD___final_mod_T /home/mstein/code/forcomp_bugs/dt_io_2.f90:43 #2 0x402fb1 in __mod_MOD_work /home/mstein/code/forcomp_bugs/dt_io_2.f90:21 #3 0x40362a in MAIN__._omp_fn.0 /home/mstein/code/forcomp_bugs/dt_io_2.f90:56 #4 0x7f726faeb83d (/usr/lib64/libgomp.so.1+0x1783d) #5 0x7f726f465558 in start_thread (/lib64/libpthread.so.0+0x7558) #6 0x7f726f19c81e in __GI___clone (/lib64/libc.so.6+0xf881e) 0x6020001956d0 is located 0 bytes inside of 8-byte region [0x6020001956d0,0x6020001956d8) freed by thread T2 here: #0 0x7f72705a7280 in __interceptor_free (/usr/lib64/libasan.so.5+0xeb280) #1 0x401935 in __mod_MOD___final_mod_T /home/mstein/code/forcomp_bugs/dt_io_2.f90:43 #2 0x402fb1 in __mod_MOD_work /home/mstein/code/forcomp_bugs/dt_io_2.f90:21 #3 0x40362a in MAIN__._omp_fn.0 /home/mstein/code/forcomp_bugs/dt_io_2.f90:56 #4 0x7f726faeb83d (/usr/lib64/libgomp.so.1+0x1783d) previously allocated by thread T2 here: #0 0x7f72705a7600 in malloc (/usr/lib64/libasan.so.5+0xeb600) #1 0x402a17 in __mod_MOD_set /home/mstein/code/forcomp_bugs/dt_io_2.f90:29 #2 0x4032a0 in __mod_MOD_work /home/mstein/code/forcomp_bugs/dt_io_2.f90:23 #3 0x40362a in MAIN__._omp_fn.0 /home/mstein/code/forcomp_bugs/dt_io_2.f90:56 #4 0x7f726faeb83d (/usr/lib64/libgomp.so.1+0x1783d) Thread T4 created by T0 here: #0 0x7f7270508620 in pthread_create (/usr/lib64/libasan.so.5+0x4c620) #1 0x7f726faebe39 (/usr/lib64/libgomp.so.1+0x17e39) #2 0x7f726fae2d59 in GOMP_parallel (/usr/lib64/libgomp.so.1+0xed59) Thread T2 created by T0 here: #0 0x7f7270508620 in pthread_create (/usr/lib64/libasan.so.5+0x4c620) #1 0x7f726faebe39 (/usr/lib64/libgomp.so.1+0x17e39) #2 0x7f726fae2d59 in GOMP_parallel (/usr/lib64/libgomp.so.1+0xed59) SUMMARY: AddressSanitizer: double-free (/usr/lib64/libasan.so.5+0xeb280) in __interceptor_free ==3485==ABORTING