From patchwork Thu Jan 18 17:15:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Malcolm X-Patchwork-Id: 189308 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp493428dyb; Thu, 18 Jan 2024 09:17:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IEp/ue21UVkatb8N5NAfmEMVd4sdGa2TwHV/hirNjE0kAs2UGdzss73lhU0N7Z3Eo/npGA9 X-Received: by 2002:ac8:5c05:0:b0:429:cf8c:6047 with SMTP id i5-20020ac85c05000000b00429cf8c6047mr1379228qti.136.1705598256420; Thu, 18 Jan 2024 09:17:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705598256; cv=pass; d=google.com; s=arc-20160816; b=VEVsNhCc4ecOCDvhTQjcXCrOKPQULhgn80mySsnCqiuIfYkunEHLw3MmA9CTTS/CMH m+Zhr+cA+Tjt2+uO0jynt3a89cRYuGgcPJFHT/OWczclAGqjMyZ40f6gL/wwjjPF90tz qOcOjI4fe++Mu4an7Z7u8LnE5T/Wekf+Q7tkZSRvPjspTe+qIr2qalFikHWwKLL428rk DfNxQHLJXQFkJOPbyXjnRjjNYQbNFT/I89TZIO+Naj+c3J8CKQFH68kQ9EoSwy6V6bNy Uix0vDVEy9xmLwIo3iF2J6g/Z3P57Rl57EwrpTXlvFkgeChX9pMGb15j5yUlMl6NVdhq Rabg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=7HQ2XZUXM51xSlQaSLT5aUTZnHOG49xG3KvExRSyof0=; fh=NXemEfxTRbZtBxUkxR2ehQUaYlcDfMdzPkO8MChVQE4=; b=LizKq6A+hjmvrIkDYSDbjnXSW3k5osZu55lycgKf9W3p4/dYgBmhKEDXZsqiPiTfo3 7ZY7aL9H3xZiDRnhX2QF48NUF5nl2TkjfYlJ77k0nNsg88CAtBp2kIivkcBSGrY5fKRm aiAEKgTU85Ob2BAq4hreFBob8RZqzhRxOnX0wO7mnGb0wOvkPqQmcqOqTfXETPdFXtMD 1OX47hpUxNhmKuA8KMfU9xhhOt78H5SkU9/lNjLAx3R4vvMJzRMOlFe1wITOq/L/yCrY fZk1sUKtqp+kME3bJBZDi2evPA8Dyl2rnnQ4NzJOR9VTKj+dL8whiSg6K5Jl+hBnMTJD 5KsA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LxoGpjva; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u4-20020a05622a010400b00429f430ebadsi7367617qtw.36.2024.01.18.09.17.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 09:17:36 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LxoGpjva; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 227E53858C2F for ; Thu, 18 Jan 2024 17:17:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id D0B55385840D for ; Thu, 18 Jan 2024 17:15:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0B55385840D Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D0B55385840D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705598154; cv=none; b=AT9Xf5T6cCmN8jnEs/m9a4k/H4eMH0Eq8b34j9bJQC8gHsxF/SPQss3yiwioT+4trHBWCmo45hrFzqrHsJgeZSeVm5XicO7iw3GG5elim8ia3ql/ZXqJo7rpKPprL+z0rNrb/2/6GL5kWBa/Eeo8BRil9mdSH72qF74XS5FHMpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705598154; c=relaxed/simple; bh=k9Jy2o8FzDrpK8oEyH0Jc6QcUFYiYnBFh10Qv+cTASQ=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=sQXCfqY6Cgi/I02vEWXis/FHixRVPHnzu3m8f56N4E74NjyDg5Ctran5fI7zYQrMg61YVndLuoRSAeAWWlMyDtzs2lTMAuWa7Dbe6MbS2eOx6PjyG8wTiIBPOSxQgm5vLPYkyo0hrvSfXmkuhlcvWN4OeIiMJZj6xJSKW7aL5AY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705598151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=7HQ2XZUXM51xSlQaSLT5aUTZnHOG49xG3KvExRSyof0=; b=LxoGpjva5/kOj6kcvsoId/B6EzRUYzsfAQisvwqTEGcFnTsX9IFjEC5M5sxeRVh9m2PpEF FOTkPZkqyOTS3xCW5506QqEhQQ/sEFibbNWwTENsRBA34LykQHCvWw729MRScKOZa5YTmN SRWTKJg4zE63X6DqEHl4znvlMrc02jU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-272-TzAD6Hj-MKGZLAP6uNE8nw-1; Thu, 18 Jan 2024 12:15:39 -0500 X-MC-Unique: TzAD6Hj-MKGZLAP6uNE8nw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 93AD412501E4 for ; Thu, 18 Jan 2024 17:15:39 +0000 (UTC) Received: from t14s.localdomain.com (unknown [10.22.32.139]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6C804112131D; Thu, 18 Jan 2024 17:15:39 +0000 (UTC) From: David Malcolm To: gcc-patches@gcc.gnu.org Cc: David Malcolm Subject: [pushed] Fix ICE in -fdiagnostics-generate-patch [PR112684] Date: Thu, 18 Jan 2024 12:15:36 -0500 Message-Id: <20240118171536.1216488-1-dmalcolm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788449397052614096 X-GMAIL-MSGID: 1788449397052614096 Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu. Pushed to trunk as r14-8255-ge254d1224df306. gcc/ChangeLog: PR middle-end/112684 * toplev.cc (toplev::main): Don't ICE in -fdiagnostics-generate-patch when exiting after options, since no edit context will have been created. Signed-off-by: David Malcolm --- gcc/toplev.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 55636ff6e80..175d4cd18fa 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -2323,11 +2323,8 @@ toplev::main (int argc, char **argv) emit some diagnostics here. */ invoke_plugin_callbacks (PLUGIN_FINISH, NULL); - if (flag_diagnostics_generate_patch) + if (auto edit_context_ptr = global_dc->get_edit_context ()) { - auto edit_context_ptr = global_dc->get_edit_context (); - gcc_assert (edit_context_ptr); - pretty_printer pp; pp_show_color (&pp) = pp_show_color (global_dc->printer); edit_context_ptr->print_diff (&pp, true);