[Bug fortran/34107] New: seg fault when writing into character variable when code compiled with -maling-double
j dot m dot h dot thomas at dl dot ac dot uk
gcc-bugzilla@gcc.gnu.org
Thu Nov 15 10:24:00 GMT 2007
I'm using the latest (precompiled) version of gfortran (GNU Fortran (GCC) 4.3.0
20071105 (experimental) [trunk revision 129892]). The following code:
program test
integer :: pid
character (len=10) :: chpid
pid=12345
write(chpid,'(i10)')pid
write(*,*)"chpid is ",chpid
end program test
when compiled with:
gfortran -o test.gfortran90 -g -malign-double ./test.f90
on my ubuntu box (Ubuntu 6.06.1 LTS, Intel(R) Pentium(R) 4 CPU 2.80GHz), seg
faults as shown below:
Program received signal SIGSEGV, Segmentation fault.
0xb7f86f46 in next_char (fmt=0x8050528, literal=0)
at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c:91
91 /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c: No such
file or directory.
in /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c
(gdb) bt
#0 0xb7f86f46 in next_char (fmt=0x8050528, literal=0)
at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c:91
#1 0xb7f86fb1 in format_lex (fmt=0x8050528)
at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c:181
#2 0xb7f87c65 in *_gfortrani_parse_format (dtp=0xbfbc1aa8)
at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/format.c:981
#3 0xb7f91e69 in data_transfer_init (dtp=0xbfbc1aa8, read_flag=0)
at /home/fx/gfortran_nightbuild/trunk/libgfortran/io/transfer.c:1802
#4 0x08048616 in test () at ./test.f90:7
If I remove the -malign-double flag, the code runs fine.
The same code in FORTRAN77 format works fine with g77 (with the -malign-double
flag), but also crashes gfortran.
--
Summary: seg fault when writing into character variable when code
compiled with -maling-double
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: j dot m dot h dot thomas at dl dot ac dot uk
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34107
More information about the Gcc-bugs
mailing list