This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/16486] New: ugly write() into a character array makes gfortran dump core
- From: "olchansk at panix dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jul 2004 01:15:41 -0000
- Subject: [Bug fortran/16486] New: ugly write() into a character array makes gfortran dump core
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This ugly code makes gfortran "gcc version 3.5.0 20040710 (experimental)" dump
core in gfc_conv_scalarized_array_ref() because in "n = se->loop->order[0];"
se->loop is NULL.
Here is the ugly code:
subroutine bar
CHARACTER(LEN=4) :: cer(5)
write (cer,113) plane, wire , dslot, ichan ,iflag
113 FORMAT(i4)
end subroutine bar
[olchansk@tw15 gfortran_test]$ make test_sprintf.o
/triumfcs/trshare/olchansk/gcc-tree-ssa/install/bin/gfortran -x f95 -c -o
test_sprintf.o -O2 -g -Wall -Waliasing -Wline-truncation -Wsurprising
-Wunused-labels -fPIC -ffixed-line-length-132 test_sprintf.f90
test_sprintf.f90: In function `bar':
test_sprintf.f90:3: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make: *** [test_sprintf.o] Error 1
Here is the f951 stack trace (made on a Fedora2 machine, gdb dumps core itself
on anything older):
unp_mod_cpp.f90: In function `do_record':
unp_mod_cpp.f90:667: warning: unused variable `first_'
unp_mod_cpp.f90:667: warning: unused variable `randnum'
Program received signal SIGSEGV, Segmentation fault.
0x08092f30 in gfc_conv_scalarized_array_ref (se=0xfefff0f0, ar=0x86872fc) at
../../gcc/gcc/fortran/trans-array.c:1422
1422 n = se->loop->order[0];
(gdb) p se
$1 = (gfc_se *) 0xfefff0f0
(gdb) p loop
No symbol "loop" in current context.
(gdb) p *se
$2 = {pre = {head = 0x0, has_scope = 0}, post = {head = 0x0, has_scope = 0},
expr = 0x55133074, string_length = 0x55126de0, descriptor_only = 0,
want_pointer = 0, direct_byref = 0, ignore_optional = 0, parent = 0x0, ss =
0x0, loop = 0x0}
(gdb) where
#0 0x08092f30 in gfc_conv_scalarized_array_ref (se=0xfefff0f0, ar=0x86872fc) at
../../gcc/gcc/fortran/trans-array.c:1422
#1 0x08092fdd in gfc_conv_array_ref (se=0xfefff0f0, ar=0x86872fc) at
../../gcc/gcc/fortran/trans-array.c:1470
#2 0x080a01ac in gfc_conv_variable (se=0xfefff0f0, expr=0x8686cb8) at
../../gcc/gcc/fortran/trans-expr.c:336
#3 0x080aa874 in set_string (block=0xfefff1c8, postblock=0xfefff1c0,
var=0x5508c1d0, var_len=0x5508c244, e=0x8686cb8) at
../../gcc/gcc/fortran/trans-io.c:401
#4 0x080aba83 in build_dt (function=0x84fae84, code=Variable "code" is not
available.
) at ../../gcc/gcc/fortran/trans-io.c:873
#5 0x08090edd in gfc_trans_code (code=0x8687750) at
../../gcc/gcc/fortran/trans.c:584
#6 0x080acb4f in gfc_trans_if_1 (code=0x8686e80) at
../../gcc/gcc/fortran/trans-stmt.c:402
#7 0x08090e01 in gfc_trans_code (code=0x8686230) at
../../gcc/gcc/fortran/trans.c:536
#8 0x080acb4f in gfc_trans_if_1 (code=0x86801e8) at
../../gcc/gcc/fortran/trans-stmt.c:402
#9 0x08090e01 in gfc_trans_code (code=0x86803f8) at
../../gcc/gcc/fortran/trans.c:536
#10 0x0809f2f3 in gfc_generate_function_code (ns=0x867ee20) at
../../gcc/gcc/fortran/trans-decl.c:2065
#11 0x0809f78f in gfc_generate_function_code (ns=0x864eec8) at
../../gcc/gcc/fortran/trans-decl.c:1895
#12 0x080911aa in gfc_generate_module_code (ns=0x85d7448) at
../../gcc/gcc/fortran/trans.c:690
#13 0x0807844d in gfc_parse_file () at ../../gcc/gcc/fortran/parse.c:2592
#14 0x0808db7a in gfc_be_parse_file (set_yydebug=0) at
../../gcc/gcc/fortran/f95-lang.c:264
#15 0x0838aee5 in toplev_main (argc=0, argv=0xfefff5e4) at
../../gcc/gcc/toplev.c:981
#16 0x006c7ad4 in __libc_start_main () from /lib/tls/libc.so.6
#17 0x0804aff1 in _start () at ../sysdeps/i386/elf/start.S:81
K.O.
--
Summary: ugly write() into a character array makes gfortran dump
core
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: olchansk at panix dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16486