$ cat internal-write.f90
  character(len=20), dimension(2) ::  line(2)
  write (unit=line(1:2),fmt='(A/A)') '1', '2'
end
$ gdb ~/libexec/gcc/i686-pc-linux-gnu/4.1.0/f951
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library
"/lib/tls/libthread_db.so.1".

(gdb) r internal-write.f90
Starting program: /home/ig25/libexec/gcc/i686-pc-linux-gnu/4.1.0/f951
internal-write.f90
 MAIN__
Program received signal SIGSEGV, Segmentation fault.
0x0809c830 in gfc_conv_scalarized_array_ref (se=0xbffff334, ar=0x8689fe4)
    at ../../gcc-4.1/gcc/fortran/trans-array.c:1618
1618        n = se->loop->order[0];
(gdb) p se->loop
$1 = (struct gfc_loopinfo *) 0x0
(gdb) bt
#0  0x0809c830 in gfc_conv_scalarized_array_ref (se=0xbffff334, ar=0x8689fe4)
    at ../../gcc-4.1/gcc/fortran/trans-array.c:1618
#1  0x0809d16d in gfc_conv_array_ref (se=0xbffff334, ar=0x8689fe4)
    at ../../gcc-4.1/gcc/fortran/trans-array.c:1662
#2  0x080a9578 in gfc_conv_expr (se=0xbffff334, expr=0x8689f88)
    at ../../gcc-4.1/gcc/fortran/trans-expr.c:420
#3  0x080b3bf8 in set_string (block=0xbffff394, postblock=0xbffff38c,
var=Variable "var" is not available.
)
    at ../../gcc-4.1/gcc/fortran/trans-io.c:400
#4  0x080b4aed in build_dt (function=0x85d1f18, code=0x868a328)
    at ../../gcc-4.1/gcc/fortran/trans-io.c:1155
#5  0x080981ba in gfc_trans_code (code=0x868a328)
    at ../../gcc-4.1/gcc/fortran/trans.c:593
#6  0x080a751e in gfc_generate_function_code (ns=0x86894a8)
    at ../../gcc-4.1/gcc/fortran/trans-decl.c:2397
#7  0x08097834 in gfc_generate_code (ns=0x86894a8)
    at ../../gcc-4.1/gcc/fortran/trans.c:683
#8  0x0807da01 in gfc_parse_file () at ../../gcc-4.1/gcc/fortran/parse.c:2639
#9  0x080971e5 in gfc_be_parse_file (set_yydebug=0)
    at ../../gcc-4.1/gcc/fortran/f95-lang.c:256
#10 0x0836d250 in toplev_main (argc=2, argv=0xbffff5f4)
    at ../../gcc-4.1/gcc/toplev.c:971
#11 0x40076974 in __libc_start_main () from /lib/tls/libc.so.6
#12 0x0804adb1 in _start () at ../sysdeps/i386/elf/start.S:102
$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.1/configure --prefix=/home/ig25 
--enable-languages=c,f95
Thread model: posix
gcc version 4.1.0 20050811 (experimental)

-- 
           Summary: compiler segfault with internal write
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 BugsThisDependsOn: 23364
OtherBugsDependingO 19274
             nThis:


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23379

Reply via email to