From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29305 invoked by alias); 24 Apr 2014 20:16:15 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 29270 invoked by uid 48); 24 Apr 2014 20:16:11 -0000 From: "awrichar at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/60956] New: error reading (and writing) large text files in gfortran Date: Thu, 24 Apr 2014 20:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.7.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: awrichar at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-04/txt/msg01842.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60956 Bug ID: 60956 Summary: error reading (and writing) large text files in gfortran Product: gcc Version: 4.7.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: awrichar at gmail dot com Created attachment 32678 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32678&action=edit demonstrates gfortran failed read/write of large text files I'm getting some buggy behavior when working with very large data files (complex, n=120^4) in gfortran 4.7.3. I get "End of record" errors when reading, and recently, "Cannot allocate memory" when writing. Originally, I was able to successfuly write the large files, but when I try to read them, gfortran issues the error: >> test_complex_sort.f90 (unit = 100, file = 'sigma_hat_1.txt') >> Fortran runtime error: End of file If I explicitly loop through each element of the array during the READ instead, gfortran has no issues. (Also if I use the Portland Group compiler and assign the array all at once, there are no issues.) If I reduce the variable size to (120^4)/12, it runs, but (120^4)/10 fails. I've written a test case (see attached), but this fails to WRITE the large file, saying: >> At line 19 of file test_complex_io.f90 (unit = 100, file = 'dummy.txt') >> Fortran runtime error: Cannot allocate memory The line in question (19) is simply >> WRITE(100, *) u and runs fine for cases (n.LT.10**8). (All cases run fine when compiling with the Portland Group Fortran compiler.) Lastly, if I generate the 4GB text file using PG Fortran, then comment out lines 18-20 in the attached file and complie with gfortran, I get a seg-fault during the READ for the n=10^8 case. These errors occurs on a computer with dual Xeon E-2690v2 processors and 256GB (not a typo) of RAM, under Ubuntu 13.04 with gfortran 4.7.3. (NOTE: When using the PG Fortran compiler, the attached code uses ~3.2GB of memory, and writes a 4GB text file for the largest test case.) Has anyone else experienced similar issues? Is this reproducible for anyone else, or in newer gfortran versions? I haven't found any recent bugs reports that seem similar, but I easily could have overlooked something. --Andy