public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/67063] New: segfault in opening a formatted file at second time with status="replace"
@ 2015-07-30  1:36 textdirected at gmail dot com
  2015-07-30  9:14 ` [Bug fortran/67063] " dominiq at lps dot ens.fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: textdirected at gmail dot com @ 2015-07-30  1:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67063

            Bug ID: 67063
           Summary: segfault in opening a formatted file at second time
                    with status="replace"
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: textdirected at gmail dot com
  Target Milestone: ---

I encountered a segfault bug in opening a formatted file at second time with
status="replace". I am using gfortran prebuilt binary of mingw64 on Windows 8.1
Pro.

For a simple program,


program gfortran51_open_bug
open(17,file='mydata.dat', status='replace')
write (17,*) 100, 200, 300
close(17)
write(*,*) "mydata.dat written first."
open(18,file='mydata.dat', status='replace')
write (18,*) -100, -200, -300
close(18)
write(*,*) "mydata.dat written second."
end program gfortran51_open_bug


My encountered bug is as follows:

PS E:\tmp> gfortran gfortran51_open_bug.f90
PS E:\tmp> .\a.exe
 mydata.dat written first.

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  ffffffffffffffff
#1  ffffffffffffffff
#2  ffffffffffffffff
#3  ffffffffffffffff
#4  ffffffffffffffff
#5  ffffffffffffffff
#6  ffffffffffffffff
#7  ffffffffffffffff
#8  ffffffffffffffff
#9  ffffffffffffffff
#10  ffffffffffffffff
#11  ffffffffffffffff
#12  ffffffffffffffff
#13  ffffffffffffffff
#14  ffffffffffffffff
#15  ffffffffffffffff
#16  ffffffffffffffff
#17  ffffffffffffffff
#18  ffffffffffffffff


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/67063] segfault in opening a formatted file at second time with status="replace"
  2015-07-30  1:36 [Bug fortran/67063] New: segfault in opening a formatted file at second time with status="replace" textdirected at gmail dot com
@ 2015-07-30  9:14 ` dominiq at lps dot ens.fr
  2015-07-31  0:24 ` textdirected at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-07-30  9:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67063

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2015-07-30
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Works for me on

COLLECT_GCC=gfc
COLLECT_LTO_WRAPPER=/opt/gcc/gcc6w/libexec/gcc/x86_64-apple-darwin14.4.0/6.0.0/lto-wrapper
Target: x86_64-apple-darwin14.4.0
Configured with: ../work/configure --prefix=/opt/gcc/gcc6w
--enable-languages=c,c++,fortran,objc,obj-c++,ada,java,lto
--with-gmp=/opt/mp-new --with-system-zlib --with-isl=/opt/mp-new --enable-lto
--enable-plugin --with-arch=corei7 --with-cpu=corei7
Thread model: posix
gcc version 6.0.0 20150729 (experimental) [trunk revision 226338p2] (GCC) 

It works also from 4.8 to 5.1.

Could you post the output of 'gfortran -v'?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/67063] segfault in opening a formatted file at second time with status="replace"
  2015-07-30  1:36 [Bug fortran/67063] New: segfault in opening a formatted file at second time with status="replace" textdirected at gmail dot com
  2015-07-30  9:14 ` [Bug fortran/67063] " dominiq at lps dot ens.fr
@ 2015-07-31  0:24 ` textdirected at gmail dot com
  2015-08-03 21:38 ` fxcoudert at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: textdirected at gmail dot com @ 2015-07-31  0:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67063

--- Comment #2 from HEMMI, Shigeru <textdirected at gmail dot com> ---
Thanks for the reply.
My output of 'gfortran -v' is:

PS E:\tmp> gfortran -v
Using built-in specs.
COLLECT_GCC=E:\mingw-w64\mingw64\bin\gfortran.exe
COLLECT_LTO_WRAPPER=E:/mingw-w64/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/5.1.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-5.1.0/configure --host=x86_64-w64-mingw32
--build=x86_64-w64-mingw32 --target=x86_64-
w64-mingw32 --prefix=/mingw64
--with-sysroot=/c/mingw510/x86_64-510-posix-seh-rt_v4-rev0/mingw64
--with-gxx-include-dir
=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static
--disable-multilib --enable-languages=ada,c,c+
+,fortran,objc,obj-c++,lto --enable-libstdcxx-time=yes --enable-threads=posix
--enable-libgomp --enable-libatomic --ena
ble-lto --enable-graphite --enable-checking=release
--enable-fully-dynamic-string --enable-version-specific-runtime-lib
s --disable-isl-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug
--enable-bootstrap --disable-rpath --di
sable-win32-registry --disable-nls --disable-werror --disable-symvers
--with-gnu-as --with-gnu-ld --with-arch=nocona --
with-tune=core2 --with-libiconv --with-system-zlib
--with-gmp=/c/mingw510/prerequisites/x86_64-w64-mingw32-static --wit
h-mpfr=/c/mingw510/prerequisites/x86_64-w64-mingw32-static
--with-mpc=/c/mingw510/prerequisites/x86_64-w64-mingw32-stat
ic --with-isl=/c/mingw510/prerequisites/x86_64-w64-mingw32-static
--with-pkgversion='x86_64-posix-seh-rev0, Built by Mi
nGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64
CFLAGS='-O2 -pipe -I/c/mingw510/x86_64-510-pos
ix-seh-rt_v4-rev0/mingw64/opt/include
-I/c/mingw510/prerequisites/x86_64-zlib-static/include
-I/c/mingw510/prerequisite
s/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe
-I/c/mingw510/x86_64-510-posix-seh-rt_v4-rev0/mingw64/opt/incl
ude -I/c/mingw510/prerequisites/x86_64-zlib-static/include
-I/c/mingw510/prerequisites/x86_64-w64-mingw32-static/includ
e' CPPFLAGS= LDFLAGS='-pipe
-L/c/mingw510/x86_64-510-posix-seh-rt_v4-rev0/mingw64/opt/lib
-L/c/mingw510/prerequisites/x
86_64-zlib-static/lib -L/c/mingw510/prerequisites/x86_64-w64-mingw32-static/lib
'
Thread model: posix
gcc version 5.1.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/67063] segfault in opening a formatted file at second time with status="replace"
  2015-07-30  1:36 [Bug fortran/67063] New: segfault in opening a formatted file at second time with status="replace" textdirected at gmail dot com
  2015-07-30  9:14 ` [Bug fortran/67063] " dominiq at lps dot ens.fr
  2015-07-31  0:24 ` textdirected at gmail dot com
@ 2015-08-03 21:38 ` fxcoudert at gcc dot gnu.org
  2015-08-04  6:59 ` textdirected at gmail dot com
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2015-08-03 21:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67063

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
                 CC|                            |fxcoudert at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Unless we know more about this, this looks really like an issue with this
specific build. Can you report it to the minnow-w64 maintainers so they can
look into it?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/67063] segfault in opening a formatted file at second time with status="replace"
  2015-07-30  1:36 [Bug fortran/67063] New: segfault in opening a formatted file at second time with status="replace" textdirected at gmail dot com
                   ` (2 preceding siblings ...)
  2015-08-03 21:38 ` fxcoudert at gcc dot gnu.org
@ 2015-08-04  6:59 ` textdirected at gmail dot com
  2015-08-04 17:43 ` ismail at donmez dot ws
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: textdirected at gmail dot com @ 2015-08-04  6:59 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67063

--- Comment #4 from HEMMI, Shigeru <textdirected at gmail dot com> ---
I look into mingw web site and found that the same error has been reported by
Yogesh Yadav.

Please take a look at http://sourceforge.net/p/mingw-w64/support-requests/103/

Thanks for taking the time for this issue.

HEMMI, Shigeru


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/67063] segfault in opening a formatted file at second time with status="replace"
  2015-07-30  1:36 [Bug fortran/67063] New: segfault in opening a formatted file at second time with status="replace" textdirected at gmail dot com
                   ` (3 preceding siblings ...)
  2015-08-04  6:59 ` textdirected at gmail dot com
@ 2015-08-04 17:43 ` ismail at donmez dot ws
  2015-08-05  3:37 ` textdirected at gmail dot com
  2015-08-08 20:25 ` fxcoudert at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: ismail at donmez dot ws @ 2015-08-04 17:43 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 3164 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67063

İsmail Dönmez <ismail at donmez dot ws> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ismail at donmez dot ws

--- Comment #5 from İsmail Dönmez <ismail at donmez dot ws> ---
You can try with my 6.x snapshots from https://i10z.com/mingw-w64/6.x/ , I
tested your testcase and it works fine.
>From gcc-bugs-return-494111-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Aug 04 18:14:00 2015
Return-Path: <gcc-bugs-return-494111-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 82186 invoked by alias); 4 Aug 2015 18:13:59 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 79191 invoked by uid 48); 4 Aug 2015 18:13:56 -0000
From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/66311] [5/6 Regression] Problems with some integer(16) values
Date: Tue, 04 Aug 2015 18:13: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: 5.1.1
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: rsandifo at gcc dot gnu.org
X-Bugzilla-Status: ASSIGNED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: rsandifo at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.3
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status assigned_to attachments.created
Message-ID: <bug-66311-4-DV9TXX7WIg@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-66311-4@http.gcc.gnu.org/bugzilla/>
References: <bug-66311-4@http.gcc.gnu.org/bugzilla/>
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: 2015-08/txt/msg00253.txt.bz2
Content-length: 798

https://gcc.gnu.org/bugzilla/show_bug.cgi?idf311

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot gnu.org

--- Comment #12 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
Created attachment 36128
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id6128&actioníit
Alternative patch

Here's an alternative patch. I haven't yet tested it beyond
an expanded version of the testcase, but I think it's easier
to follow if we separate the "val != valres" and "need an extra
zero block" logic.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/67063] segfault in opening a formatted file at second time with status="replace"
  2015-07-30  1:36 [Bug fortran/67063] New: segfault in opening a formatted file at second time with status="replace" textdirected at gmail dot com
                   ` (4 preceding siblings ...)
  2015-08-04 17:43 ` ismail at donmez dot ws
@ 2015-08-05  3:37 ` textdirected at gmail dot com
  2015-08-08 20:25 ` fxcoudert at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: textdirected at gmail dot com @ 2015-08-05  3:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67063

HEMMI, Shigeru <textdirected at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #6 from HEMMI, Shigeru <textdirected at gmail dot com> ---
Thanks for the support but the problem not solved on my PC.

E:\tmp>set PATH=%PATH%;E:\mingw-w64\mingw-w64-6.0.0\bin
E:\tmp>x86_64-w64-mingw32-gfortran.exe gfortran51_open_bug.f90
E:\tmp>.\a.exe

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

Backtrace for this error:
#0  ffffffffffffffff
#1  ffffffffffffffff
#2  ffffffffffffffff
#3  ffffffffffffffff
#4  ffffffffffffffff
#5  ffffffffffffffff
#6  ffffffffffffffff
#7  ffffffffffffffff
#8  ffffffffffffffff
#9  ffffffffffffffff
#10  ffffffffffffffff
#11  ffffffffffffffff
#12  ffffffffffffffff
#13  ffffffffffffffff
#14  ffffffffffffffff
#15  ffffffffffffffff
#16  ffffffffffffffff
#17  ffffffffffffffff
#18  ffffffffffffffff


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug fortran/67063] segfault in opening a formatted file at second time with status="replace"
  2015-07-30  1:36 [Bug fortran/67063] New: segfault in opening a formatted file at second time with status="replace" textdirected at gmail dot com
                   ` (5 preceding siblings ...)
  2015-08-05  3:37 ` textdirected at gmail dot com
@ 2015-08-08 20:25 ` fxcoudert at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2015-08-08 20:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67063

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #7 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
This is an issue with the specific builds (mingw32) you're working with, not a
generic gfortran issue. Please report it directly to the site/team you've
downloaded your compiler from.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-08-08 20:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-30  1:36 [Bug fortran/67063] New: segfault in opening a formatted file at second time with status="replace" textdirected at gmail dot com
2015-07-30  9:14 ` [Bug fortran/67063] " dominiq at lps dot ens.fr
2015-07-31  0:24 ` textdirected at gmail dot com
2015-08-03 21:38 ` fxcoudert at gcc dot gnu.org
2015-08-04  6:59 ` textdirected at gmail dot com
2015-08-04 17:43 ` ismail at donmez dot ws
2015-08-05  3:37 ` textdirected at gmail dot com
2015-08-08 20:25 ` fxcoudert at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).