From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A5B713973026; Fri, 8 Jan 2021 11:18:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5B713973026 From: "keith.marshall at mailinator dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug jit/98586] libgccjit crashes with segmentation fault on failed gcc_assert Date: Fri, 08 Jan 2021 11:18:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: jit X-Bugzilla-Version: 9.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: keith.marshall at mailinator dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm 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: 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: Fri, 08 Jan 2021 11:18:27 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98586 --- Comment #2 from Keith Marshall -= -- (In reply to David Malcolm from comment #1) > I looked at calling diagnostic_initialize. >=20 > Unfortunately, libgccjit supports being linked into multithreaded process= es, > and it guards all of the regular compiler state with a single big mutex, > including the diagnostic subsystem (and the "global_dc" pointer implicitly > used by fancy_abort). This failure is happening before the mutex is > acquired. Indeed, yes. I actually patched the mutex acquisition/release code, to use= a native MS-Windows critical section, in preference to the alien pthreads mut= ex: https://osdn.net/ticket/download.php?group_id=3D3917&tid=3D41070&file_id= =3D5791 I thought that, maybe, it was my modification which led to the crash; I was surprised to find that execution never reached my modified code. > I'm not sure yet what the best fix is. I don't know the GCC internals well enough, to advise on this, but I'm will= ing to assist with testing, in any way that I can. In the meantime, I've patch= ed around the flawed assumption, which leads to the failing assertion, in the first place: https://osdn.net/ticket/download.php?group_id=3D3917&tid=3D41070&file_id= =3D5799 Thanks for your attention.=