From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa4.mentor.iphmx.com (esa4.mentor.iphmx.com [68.232.137.252]) by sourceware.org (Postfix) with ESMTPS id 873AD3857822 for ; Tue, 17 May 2022 10:15:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 873AD3857822 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="5.91,232,1647331200"; d="scan'208,223";a="75992516" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa4.mentor.iphmx.com with ESMTP; 17 May 2022 02:15:42 -0800 IronPort-SDR: vhS5LZ0ohK4JjtRPwzCNzez4fCW1sZo54EU2MG7BIP6VhNHXMGHLRFryAncWZaRoEMJVMiB5Cg 1yHTiiqCU7b8yBhS1WxSb7gaKdV1MkOqVI9MLdKAfeG5HED9rChA5J5eTegyGLOV83Lrmb6ooR E+Wvd9nniC4K2B+st/b4N35I5W/jCUAVZ41sBT/h+Xw8xvOKmD/m9PUYOs03gBZ0v1FO9kKrEt DawGxEtLVohZ9y0DBP216NvVUTuLqBcsuG6A1yfmWQyV2XDWQHAZJ2tj+9hnpC994OcN54T3At MHM= From: Thomas Schwinge To: Richard Biener , Subject: [PING] Advise to call 'internal_error' instead of 'abort' or 'fancy_abort' In-Reply-To: <87pmklpjrz.fsf@dem-tschwing-1.ger.mentorg.com> References: <87czgwkp8t.fsf@euler.schwinge.homeip.net> <87pmkvqbdy.fsf@dem-tschwing-1.ger.mentorg.com> <87levire8p.fsf@dem-tschwing-1.ger.mentorg.com> <87pmklpjrz.fsf@dem-tschwing-1.ger.mentorg.com> User-Agent: Notmuch/0.29.1+93~g67ed7df (https://notmuchmail.org) Emacs/26.3 (x86_64-pc-linux-gnu) Date: Tue, 17 May 2022 12:15:36 +0200 Message-ID: <87h75opirb.fsf@dem-tschwing-1.ger.mentorg.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: SVR-IES-MBX-07.mgc.mentorg.com (139.181.222.7) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2022 10:15:46 -0000 --=-=-= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi! Ping. Gr=C3=BC=C3=9Fe Thomas On 2022-05-10T16:03:12+0200, I wrote: > Hi! > > On 2022-05-03T15:46:43+0200, Richard Biener = wrote: >> On Tue, May 3, 2022 at 2:29 PM Thomas Schwinge = wrote: >>> On 2022-05-03T12:53:50+0200, Richard Biener wrote: >>> > On Tue, May 3, 2022 at 10:16 AM Thomas Schwinge wrote: >>> >> On 2022-05-03T09:17:52+0200, Richard Biener wrote: >>> >> > On Mon, May 2, 2022 at 4:01 PM Thomas Schwinge wrote: >>> >> > +#if 0 >>> >> > gcc_unreachable (); >>> >> > +#else >>> >> > + /* ..., but due to bugs (PR100400), we may actually come he= re. >>> >> > + Reliably catch this, regardless of checking level. */ >>> >> > + abort (); >>> >> > +#endif >>> >> > >>> >> > this doesn't look correct. If you want a reliable diagnostic here= please [...] >>> >> > call internal_error () manually (the IL verifiers do this). >>> >> >>> >> Hmm, I feel I'm going in circles... ;-) > >>> >> I first had this as 'internal_error', but then saw the following sou= rce >>> >> code comment, 'gcc/diagnostic.cc': >>> >> >>> >> /* An internal consistency check has failed. We make no attempt= to >>> >> continue. Note that unless there is debugging value to be ha= d from >>> >> a more specific message, or some other good reason, you shoul= d use >>> >> abort () instead of calling this function directly. */ >>> >> void >>> >> internal_error (const char *gmsgid, ...) >>> >> { >>> >> >>> >> Here, there's no "debugging value to be had from a more specific >>> >> message", and I couldn't think of "some other good reason", so decid= ed to >>> >> "use abort () instead of calling this function directly". >>> > >>> > I think that is misguided. >>> >>> So that I know which one to fix/reconsider: does your "that" refer to t= he >>> 'gcc/diagnostic.cc:internal_error' source code comment cited above, or = my >>> interpretation of it? >> >> The comment to "use abort ()". > > Does the attached > "Advise to call 'internal_error' instead of 'abort' or 'fancy_abort'" > capture what you had in mind? > > (This is, obviously, not updating any of the many 'abort' or even a few > 'fancy_abort' calls that we currently have.) > > > Gr=C3=BC=C3=9Fe > Thomas ----------------- Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe 201= , 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaf= t: M=C3=BCnchen; Registergericht M=C3=BCnchen, HRB 106955 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename="0001-Advise-to-call-internal_error-instead-of-abort-or-fa.patch" >From a8017c7b5fa7b5e8210b6446acf7dd09989a7517 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Tue, 10 May 2022 15:56:08 +0200 Subject: [PATCH] Advise to call 'internal_error' instead of 'abort' or 'fancy_abort' gcc/ * diagnostic.cc: Don't advise to call 'abort' instead of 'internal_error'. * system.h: Advise to call 'internal_error' instead of 'abort' or 'fancy_abort'. Suggested-by: Richard Biener --- gcc/diagnostic.cc | 4 +--- gcc/system.h | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/diagnostic.cc b/gcc/diagnostic.cc index 73324a728fe..fef11467b6f 100644 --- a/gcc/diagnostic.cc +++ b/gcc/diagnostic.cc @@ -1935,9 +1935,7 @@ fatal_error (location_t loc, const char *gmsgid, ...) } /* An internal consistency check has failed. We make no attempt to - continue. Note that unless there is debugging value to be had from - a more specific message, or some other good reason, you should use - abort () instead of calling this function directly. */ + continue. */ void internal_error (const char *gmsgid, ...) { diff --git a/gcc/system.h b/gcc/system.h index c25cd64366f..187763efcd6 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -770,8 +770,10 @@ extern int vsnprintf (char *, size_t, const char *, va_list); #endif #endif -/* Redefine abort to report an internal error w/o coredump, and - reporting the location of the error in the source file. */ +/* Redefine 'abort' to report an internal error w/o coredump, and + reporting the location of the error in the source file. + Instead of directly calling 'abort' or 'fancy_abort', GCC code + should normally call 'internal_error' with a specific message. */ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN ATTRIBUTE_COLD; #define abort() fancy_abort (__FILE__, __LINE__, __FUNCTION__) -- 2.25.1 --=-=-=--