From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A92253851C06; Mon, 18 May 2020 22:54:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A92253851C06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1589842460; bh=p86wAmYCFgdFoqqd8oaKN7z/PUGcOe6we6U6iVBS8iI=; h=From:To:Subject:Date:From; b=nQitXi6tBQtGM+QwUZjPw2b2hvzDbOIU/gx6G79cRIt/VrqUGNWWmAfOdgsd0OC+R 8bRFokaZmb1EeBoSlSzY0zvnpQS2TYfPt7IudUcLQjnX4QZGHJNXwnSyREZzuqKd8Y yGICZIJgboK+K55QRMXNRm3wLhSsLDLYS0w1KTh0= From: "longb at cray dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/95195] New: gfortran poorly handles a program error of writing a namelist to an unformatted file. Date: Mon, 18 May 2020 22:54:20 +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: 9.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: longb at cray dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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 target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 May 2020 22:54:20 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95195 Bug ID: 95195 Summary: gfortran poorly handles a program error of writing a namelist to an unformatted file. Product: gcc Version: 9.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: longb at cray dot com Target Milestone: --- gfortran poorly handles a program error of writing a namelist to an unforma= tted file. > cat test.f90 program test character(len=3D16) my_form character(len=3D240) msg data my_form /'unformatted'/ namelist /nml1/ i, j, k i =3D 1; j =3D 2; k =3D 3 open (unit=3D10, file=3D'test.dat') write (10, nml=3Dnml1) close (10) open (unit=3D10, file=3D'test.dat', form=3Dmy_form) read (unit=3D10, nml=3Dnml1) close (unit=3D10, status=3D'delete') end program test > gfortran test.f90 > ./a.out Program received signal SIGSEGV: Segmentation fault - invalid memory refere= nce. Backtrace for this error: #0 0x7fadb087459f in ??? #1 0x7fadb15bf69e in fbuf_getc at ../../../cray-gcc-9.3.0-202003310324.b29d417121fbe/libgfortran/io/fbuf.h= :78 #2 0x7fadb15bf69e in next_char_default at ../../../cray-gcc-9.3.0-202003310324.b29d417121fbe/libgfortran/io/list_read= .c:215 #3 0x7fadb15bf69e in next_char_default at ../../../cray-gcc-9.3.0-202003310324.b29d417121fbe/libgfortran/io/list_read= .c:207 #4 0x7fadb15c8db7 in finalize_transfer at ../../../cray-gcc-9.3.0-202003310324.b29d417121fbe/libgfortran/io/transfer.= c:4109 #5 0x400bf7 in ??? #6 0x400c7c in ??? #7 0x7fadb085f349 in ??? #8 0x400779 in ??? at ../sysdeps/x86_64/start.S:120 #9 0xffffffffffffffff in ??? Segmentation fault (core dumped) > gfortran --version GNU Fortran (GCC) 9.3.0 20200312 (Cray Inc.) Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A diagnostic message along the lines of the Cray or Intel compilers is preferred: > module swap PrgEnv-gnu PrgEnv-cray > ftn test.f90 > ./a.out lib-4080 : UNRECOVERABLE library error A formatted read or write is not allowed on an unformatted file. Encountered during a namelist READ from unit 10 Fortran unit 10 is connected to a sequential unformatted file: "test.dat" Aborted (core dumped) > module swap PrgEnv-cray PrgEnv-intel > ifort test.f90 > ./a.out forrtl: severe (257): formatted I/O to unit open for unformatted transfers, unit 10, file //test.dat Image PC Routine Line Source a.out 000000000040546B Unknown Unknown Unknown a.out 000000000041EF5E Unknown Unknown Unknown a.out 0000000000402C31 Unknown Unknown Unknown a.out 0000000000402A12 Unknown Unknown Unknown libc-2.26.so 00007FC2FABAF34A __libc_start_main Unknown Unknown a.out 000000000040292A Unknown Unknown Unknown=