Red Hat Bugzilla – Bug 253102
gfortran generates incorrect code for temporary array of strings
Last modified: 2007-11-30 17:12:13 EST
Description of problem:
The attached test.F90 contains a subroutine which constructs a temporary array
of strings from one of its own input strings. The code will compile, but the
resulting program crashes when run.
Version-Release number of selected component (if applicable):
gcc-gfortran-4.1.2-12 (latest gfortran for Fedora 7 i686 and x86_64)
gcc-gfortran-4.1.1-52.el5.2 (latest gfortran for RHEL 5 ia64)
Always (at least on the i686, x86_64, and ia64 boxes I've tried it on)
Steps to Reproduce:
1. Compile the test program with 'gfortran -g test.F90'
2. Run it with './a.out'
Program crashes with a segmentation fault. gdb output suggests that the heap is
Program received signal SIGSEGV, Segmentation fault.
0x4f793756 in _int_free () from /lib/libc.so.6
#0 0x4f793756 in _int_free () from /lib/libc.so.6
#1 0x4f797430 in free () from /lib/libc.so.6
#2 0x4f8f50c1 in _gfortran_internal_free () from /usr/lib/libgfortran.so.1
#3 0x0804874e in __testmod__test_sub (padstr=@0xbf912523, strarr=@0xbf9124d3,
_padstr=5, _strarr=80) at test.F90:14
#4 0x080487f0 in MAIN__ () at test.F90:27
#5 0x08048827 in main ()
Program should run to completion (as in fact it does when compiled with NAG, PGI
or Intel Fortran compilers).
Created attachment 161701 [details]
test.F90, minimal Fortran 90 testcase
gcc-4.1.2-18.fc7 has been pushed to the Fedora 7 testing repository. If problems still persist, please make note of it in this bug report.
gcc-4.1.2-27.fc7 has been pushed to the Fedora 7 stable repository. If problems still persist, please make note of it in this bug report.