------- Comment #5 from jvdelisle at gcc dot gnu dot org 2006-08-18 20:54 ------- Here is a debug trace showing the steps leading up to the mutation of the dtp pointer. StevebB on IRC indicated that the assembly output on linux x86-64 natch the freebsd version I posted here and the problem does not occur on that platform. Notice the before an after values of the dtp pointer!
(gdb) s *_gfortran_st_write_done (dtp=0x7fffffffe640) at ../../../gcc4x/libgfortran/io/transfer.c:2546 2546 if (dtp->u.p.scratch != NULL) (gdb) s 2548 if (dtp->u.p.current_unit != NULL) (gdb) s 2549 unlock_unit (dtp->u.p.current_unit); (gdb) s *_gfortrani_unlock_unit (u=0x2008103b0) at gthr-posix.h:566 566 if (__gthread_active_p ()) (gdb) p dtp No symbol "dtp" in current context. (gdb) p u $5 = (gfc_unit *) 0x2008103b0 (gdb) p *u $6 = {unit_number = 10, s = 0x200828000, left = 0x0, right = 0x0, priority = 14047, read_bad = 1, current_record = 1, endfile = NO_ENDFILE, mode = WRITING, flags = {access = ACCESS_STREAM, action = ACTION_READWRITE, blank = BLANK_NULL, delim = DELIM_NONE, form = FORM_UNFORMATTED, is_notpadded = 0, position = POSITION_ASIS, status = STATUS_UNKNOWN, pad = PAD_YES, convert = CONVERT_NATIVE}, recl = 1, last_record = 25, maxrec = 9223372036854775807, bytes_left = 0, lock = 0x0, waiting = 0, closed = 0, ls = 0x0, rank = 0, file_len = 10, file = 0x20082c140 "teststream"} (gdb) s 567 return __gthrw_(pthread_mutex_unlock) (mutex); (gdb) s Breakpoint 1, *_gfortran_st_write (dtp=0x7fffffffe7d0) at ../../../gcc4x/libgfortran/io/transfer.c:2506 2506 { -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28747