In a larger program of mine, I got a SIGSEGV when printing WRITE(*,fmtstr) & dat(1),"-",dat(2),"-",dat(3), & datedelim,dat(4),":",dat(5), & (delim,bufarr(pindx),pindx=1,anzarg2) with gfortran 4.5 (latest snapshot). Using gfortran 4.3.5 the code runs fine. Unfortunately, I can not reproduce the crash in a standalone program. In the above print statement, fmtstr is rather large (~550chars). Here is the gdb output: Program received signal SIGSEGV, Segmentation fault. reset_node (fn=0xc) at ../../../gfortran-source/gcc-4.5-20100107/libgfortran/io/format.c:111 111 if (fn->format != FMT_LPAREN) (gdb) where #0 reset_node (fn=0xc) at ../../../gfortran-source/gcc-4.5-20100107/libgfortran/io/format.c:111 #1 0x0000000000423b30 in reset_fnode_counters () at ../../../gfortran-source/gcc-4.5-20100107/libgfortran/io/format.c:134 #2 parse_format () at ../../../gfortran-source/gcc-4.5-20100107/libgfortran/io/format.c:1233 #3 0x0000000000418208 in data_transfer_init (dtp=0x7ffffffead80, read_flag=0) at ../../../gfortran-source/gcc-4.5-20100107/libgfortran/io/transfer.c:2182 #4 0x000000000040ba86 in writevals (startjul=<value optimized out>, endjul=<value optimized out>, reqts=<value optimized out>, basets=<value optimized out>, use_monthtu=<value optimized out>, station=<value optimized out>, param=<value optimized out>, aggrtypes=<value optimized out>, parfmt2=<value optimized out>, valarr2=<value optimized out>, datefmt=<value optimized out>, delim=<value optimized out>, missing=<value optimized out>, anzarg2=<value optimized out>, anzval=<value optimized out>, toffset=<value optimized out>, qualarr=<value optimized out>, wantqf=<value optimized out>, _station=<value optimized out>, _param=<value optimized out>, _aggrtypes=<value optimized out>, _parfmt2=<value optimized out>, _delim=<value optimized out>, _missing=<value optimized out>) at extractdata.f:1464 #5 0x0000000000407818 in extractdata () at extractdata.f:58 #6 0x0000000000407906 in main (argc=<value optimized out>, argv=<value optimized out>) at extractdata.f:1179 #7 0x000000000042b406 in __libc_start_main (main=<value optimized out>, argc=<value optimized out>, ubp_av=<value optimized out>, init=0x42b8b0 <__libc_csu_init>, fini=0x42b870 <__libc_csu_fini>, rtld_fini=0, stack_end=0x7fffffffdf98) at libc-start.c:220 #8 0x0000000000400209 in _start () at ../sysdeps/x86_64/elf/start.S:113 (gdb) list 106 fnode *f; 107 108 fn->count = 0; 109 fn->current = NULL; 110 111 if (fn->format != FMT_LPAREN) 112 return; 113 114 for (f = fn->u.child; f; f = f->next) 115 { Hopefully this gives already some clues. Otherwise please tell me how to debug further.
Created attachment 19596 [details] test case
This write statement is called in a loop, and it crashes at the second iteration. I did first a test case with only this write statement, and it works OK. Then, I put a loop around it, and I catched it! So the attached test case crashes for me with # ./writebug 2009-10-31 03:00 2.8 7.8 7.3 7.6 7.1 -0.2 2.6 7.3 7.6 7.9 8.2 2.5 7.0 8.0 7.5 6.6 7.8 5.7 9.4 7.3 -0.6 5.2 7.7 8.5 8.8 4.7 7.7 7.7 7.4 7.4 1.2 5.9 2.6 2.5 8.0 7.1 7.2 8.8 3.9 ? 3.0 2.2 7.3 3.1 1.7 -6.3 5.4 6.3 6.2 -4.5 0.2 4.5 0.3 6.0 9.8 2.9 12.0 11.0 12.7 11.1 0.0 3.7 3.0 -0.9 2.2 -0.4 0.0 -4.6 -6.7 1.8 -0.8 ? ? 4.3 Program received signal 11 (SIGSEGV): Segmentation fault. Backtrace for this error: + /lib64/libc.so.6 [0x7f0d7ee7b560] + in the main program from file writebug.f + /lib64/libc.so.6(__libc_start_main+0xfd) [0x7f0d7ee67a7d]
Sorry, I made a mess. *** This bug has been marked as a duplicate of 42742 ***