From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8730 invoked by alias); 28 Jun 2014 21:20:06 -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 8591 invoked by uid 48); 28 Jun 2014 21:19:59 -0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/61632] memory corruption in Fortran RTL when writing formatted data Date: Sat, 28 Jun 2014 21:20:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: NEW 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: Message-ID: In-Reply-To: References: 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-06/txt/msg02316.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61632 --- Comment #3 from Dominique d'Humieres --- With the following reduced test program p CHARACTER(3), save :: ZTYP(3) DATA ZTYP /'XXX','YYY','ZZZ'/ write(*,600,IOSTAT=iosa) 0.0,ZTYP if (iosta /= 0) print *, 'error' write(*,600,IOSTAT=iosa) 0.0,ZTYP if (iosta /= 0) print *, 'error' 600 FORMAT(1PE13.5,4X,A3) end program p valgrind reports ==95142== Memcheck, a memory error detector ==95142== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==95142== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==95142== Command: a.out ==95142== 0.00000E+00 XXX error 0.00000E+00 XXX ==95142== Invalid write of size 8 ==95142== at 0x1000DCF40: _gfortrani_format_error (in /opt/gcc/gcc4.10w/lib/libgfortran.3.dylib) ==95142== by 0x6F66204C4145521F: ??? ==95142== by 0x33206D6574692071: ??? ==95142== by 0x6D726F66206E691F: ??? ==95142== by 0x7274206465747460: ??? ==95142== by 0x202C726566736E60: ??? ==95142== by 0x5241484320746F66: ??? ==95142== by 0xA5245544340: ??? ==95142== by 0x32AAABA6: ??? ==95142== Address 0x7fff5f7adda9 is not stack'd, malloc'd or (recently) free'd ==95142== ==95142== Invalid read of size 8 ==95142== at 0x1000DCF45: _gfortrani_format_error (in /opt/gcc/gcc4.10w/lib/libgfortran.3.dylib) ==95142== by 0x6F66204C4145521F: ??? ==95142== by 0x33206D6574692071: ??? ==95142== by 0x6D726F66206E691F: ??? ==95142== by 0x7274206465747460: ??? ==95142== by 0x202C726566736E60: ??? ==95142== by 0x5241484320746F66: ??? ==95142== by 0xA5245544340: ??? ==95142== by 0x32AAABA6: ??? ==95142== Address 0x10045166c is not stack'd, malloc'd or (recently) free'd ==95142== ==95142== ==95142== Process terminating with default action of signal 11 (SIGSEGV) ==95142== General Protection Fault ==95142== at 0x100298FC1: dyld_stub_binder (in /usr/lib/libSystem.B.dylib) ==95142== by 0x10013502F: ??? (in /opt/gcc/gcc4.10w/lib/libgfortran.3.dylib) ==95142== by 0x10013502F: ??? (in /opt/gcc/gcc4.10w/lib/libgfortran.3.dylib) ==95142== by 0x6F66204C4145521F: ??? ==95142== by 0x33206D6574692071: ??? ==95142== by 0x6D726F66206E691F: ??? ==95142== by 0x7274206465747460: ??? ==95142== by 0x202C726566736E60: ??? ==95142== by 0x5241484320746F66: ??? ==95142== by 0xA5245544340: ??? ==95142== by 0x4FFFFF: ??? ==95142== ==95142== HEAP SUMMARY: ==95142== in use at exit: 7,732 bytes in 21 blocks ==95142== total heap usage: 23 allocs, 2 frees, 8,244 bytes allocated ==95142== ==95142== LEAK SUMMARY: ==95142== definitely lost: 0 bytes in 0 blocks ==95142== indirectly lost: 0 bytes in 0 blocks ==95142== possibly lost: 0 bytes in 0 blocks ==95142== still reachable: 7,644 bytes in 20 blocks ==95142== suppressed: 88 bytes in 1 blocks ==95142== Rerun with --leak-check=full to see details of leaked memory ==95142== ==95142== For counts of detected and suppressed errors, rerun with: -v ==95142== ERROR SUMMARY: 380 errors from 2 contexts (suppressed: 0 from 0) Segmentation fault