Bug 253102

Summary: gfortran generates incorrect code for temporary array of strings
Product: [Fedora] Fedora Reporter: Ben Webb <benmwebb>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 7   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 4.1.2-27.fc7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-09-28 21:24:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
test.F90, minimal Fortran 90 testcase none

Description Ben Webb 2007-08-16 22:49:38 UTC
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)

How reproducible:
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'
  
Actual results:
Program crashes with a segmentation fault. gdb output suggests that the heap is
corrupted:
Program received signal SIGSEGV, Segmentation fault.
0x4f793756 in _int_free () from /lib/libc.so.6
(gdb) bt
#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 ()



Expected results:
Program should run to completion (as in fact it does when compiled with NAG, PGI
or Intel Fortran compilers).

Comment 1 Ben Webb 2007-08-16 22:49:38 UTC
Created attachment 161701 [details]
test.F90, minimal Fortran 90 testcase

Comment 3 Fedora Update System 2007-08-29 17:27:44 UTC
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.

Comment 4 Fedora Update System 2007-09-28 21:24:42 UTC
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.