From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5462F386F46E; Thu, 28 May 2020 08:34:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5462F386F46E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1590654859; bh=sxBqF3BIJ6btar4+J15uvjFUTKHZM3L1kRiTCAwptE8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=veRlC9+RryIHJ3VDbas5tLZ8JNkMVsRN1NRd9xJbRHd6lhVilBlTtUDkrUbdVC+oe v2WMqg1bIOY6bY1ctT04ZiCTgcxmrxuZfrUcLY2lyfcm7n7cKr7SnGFn2y4vb+8lZt Dav4XtVBRdbKqFwjHgdFTaiMMq37cI/tFxVppvME= From: "ro at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/95104] [9/10 Regression] Segfault on a legal WAIT statement Date: Thu, 28 May 2020 08:34:19 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ro at gcc dot gnu.org X-Bugzilla-Status: REOPENED X-Bugzilla-Resolution: X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: anlauf at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status cc Message-ID: In-Reply-To: References: 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: Thu, 28 May 2020 08:34:19 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D95104 Rainer Orth changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|FIXED |--- Status|RESOLVED |REOPENED CC| |ro at gcc dot gnu.org --- Comment #13 from Rainer Orth --- The new testcase FAILs on (at least): Solaris (both sparc and x86): +FAIL: gfortran.dg/pr95104.f90 -O0 execution test +FAIL: gfortran.dg/pr95104.f90 -O1 execution test +FAIL: gfortran.dg/pr95104.f90 -O2 execution test +FAIL: gfortran.dg/pr95104.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test +FAIL: gfortran.dg/pr95104.f90 -O3 -g execution test +FAIL: gfortran.dg/pr95104.f90 -Os execution test Program received signal SIGSEGV: Segmentation fault - invalid memory refere= nce. Backtrace for this error: After recompiling libgfortran with -g3 -O0, I see Thread 2 received signal SIGSEGV, Segmentation fault. [Switching to Thread 1 (LWP 1)] 0xfec554a8 in pthread_mutex_unlock () from /lib/libc.so.1 (gdb) where #0 0xfec554a8 in pthread_mutex_unlock () from /lib/libc.so.1 #1 0xff1287bc in __gthread_mutex_unlock (__mutex=3D0xc8) at ../libgcc/gthr-default.h:779 #2 0xff12a178 in _gfortrani_unlock_unit (u=3D0x0) at /vol/gcc/src/hg/master/local/libgfortran/io/unit.c:771 #3 0xff127ffc in _gfortran_st_wait_async (wtp=3D0xffbfe750) at /vol/gcc/src/hg/master/local/libgfortran/io/transfer.c:4511 #4 0x00010eac in test () at /vol/gcc/src/hg/master/local/gcc/testsuite/gfortran.dg/pr95104.f90:5 #5 0x00010f40 in main (argc=3D1, argv=3D0xffbfe992) at /vol/gcc/src/hg/master/local/gcc/testsuite/gfortran.dg/pr95104.f90:8 #6 0x00010c74 in _start () #3 0xff127ffc in _gfortran_st_wait_async (wtp=3D0xffbfe750) at /vol/gcc/src/hg/master/local/libgfortran/io/transfer.c:4511 4511 unlock_unit (u); (gdb) p u $2 =3D (gfc_unit *) 0x0 Either the unlock_unit needs to be guarded by if (u) or moved into the=20 if (ASYNC_IO && u ...) check.=