From patchwork Tue Sep 12 17:27:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 1833129 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=RlJmqtD5; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RlVs06gPyz1yhZ for ; Wed, 13 Sep 2023 03:27:32 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E51103858412 for ; Tue, 12 Sep 2023 17:27:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E51103858412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694539650; bh=yl0CSsL7tIw0pUjDGy7BSj5eFvPDtS6v/Zs8SNb/gvc=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=RlJmqtD59x1UdQmzlV8wWBnZpQhorsqHO6sDTUv1ZgfDiDornZ6i1r2EteeykSZ9B lYKRjzLljZyljmjuT8cLbUjEVU+sbKjl2swEqgZfTWmmG2uI8gzBT+UhMMtptrNGg+ oDKJi+gRebikWukbglkkmp8J7XzeCQeVCyPaNHwg= 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.129.124]) by sourceware.org (Postfix) with ESMTPS id 74B273858C50 for ; Tue, 12 Sep 2023 17:27:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74B273858C50 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-367-5bVumrmNO0iIN4t5kWMAOg-1; Tue, 12 Sep 2023 13:27:07 -0400 X-MC-Unique: 5bVumrmNO0iIN4t5kWMAOg-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6557c921df1so58774706d6.2 for ; Tue, 12 Sep 2023 10:27:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694539627; x=1695144427; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yl0CSsL7tIw0pUjDGy7BSj5eFvPDtS6v/Zs8SNb/gvc=; b=idb8mz5EPFsnCvHGwQvNhPOM5CK6aKieJG4bxBn4c3ZDcDd18nq0G3bnYhxydx9jvj IrA5ePkG69vZcgG0miokLbqInkxdzbov+gRv1P1Til8fO3ipopyOCh3LRdbAI8Ai7chJ 5ijsR1+JpBqRzjE2HEg9SqEQbFJwStT4fuvOMMqP99OkU2sQgJQ+2uigIYRTlB5BqPsh EqSlbmlpxVdW710/Ae0mY1KFkZMPA/0O0hP7l92Ke+s4Po4Ki2tjMSRvkQpa0NTJEvBI Cj4vKbtboAaTGh6Xsv/clxXlVgowbyrqZgtNteijy3ALBjhzHurtg4A06Z3DAF6R1GIk AwtA== X-Gm-Message-State: AOJu0Yxi+YqVy+nAtnEHhsf/Y3T5E7fWM+bHNGZcNRGNjy3GCYa04JW+ FmOtqixUxueeYM3qTQTg4uvRkjvConTu8rFvDZQIEKz+gzgsM9cpZeSIA38fHAwPUL1sw06ukdX aDyGirhYpCnR5xEEcZ1eQn5+gNlbN7GOzGbCWi5zYxzUnFM0Emv6mFEl2UuUMw0vLIT4CsPKhzQ == X-Received: by 2002:a05:6214:5786:b0:636:1daa:94e with SMTP id lv6-20020a056214578600b006361daa094emr74859qvb.38.1694539627100; Tue, 12 Sep 2023 10:27:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGw9BHAiehFYIOnpK+Nf9y78Sc8+DJjmn9uLEwlS7Sb4ozXXlTVTRXDXztPHPgUIYxqXWkN+g== X-Received: by 2002:a05:6214:5786:b0:636:1daa:94e with SMTP id lv6-20020a056214578600b006361daa094emr74841qvb.38.1694539626644; Tue, 12 Sep 2023 10:27:06 -0700 (PDT) Received: from jason.com (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id e18-20020a0cf352000000b0064f5020df91sm3791996qvm.28.2023.09.12.10.27.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 10:27:05 -0700 (PDT) To: gcc-patches@gcc.gnu.org Subject: [pushed] c++: ICE with -fno-exceptions and array init [PR107198] Date: Tue, 12 Sep 2023 13:27:03 -0400 Message-Id: <20230912172703.1929911-1-jason@redhat.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.6 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_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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: , X-Patchwork-Original-From: Jason Merrill via Gcc-patches From: Jason Merrill Reply-To: Jason Merrill Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-pc-linux-gnu, applying to trunk. -- 8< -- The removed line no longer has an effect on anew5.C error recovery, and removing it improves error recovery for this testcase. PR c++/107198 gcc/cp/ChangeLog: * typeck2.cc (process_init_constructor_array): Use VEC_INIT_EXPR regardless of seen_error. gcc/testsuite/ChangeLog: * g++.dg/eh/no-exceptions1.C: New test. --- gcc/cp/typeck2.cc | 1 - gcc/testsuite/g++.dg/eh/no-exceptions1.C | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/eh/no-exceptions1.C base-commit: 27e2e7c93e48bcbb63877cc5964fae8dba47d706 diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc index 582a73bb053..cd1ea045720 100644 --- a/gcc/cp/typeck2.cc +++ b/gcc/cp/typeck2.cc @@ -1683,7 +1683,6 @@ process_init_constructor_array (tree type, tree init, int nested, int flags, if (next) { if (next != error_mark_node - && ! seen_error () // Improves error-recovery on anew5.C. && (initializer_constant_valid_p (next, TREE_TYPE (next)) != null_pointer_node)) { diff --git a/gcc/testsuite/g++.dg/eh/no-exceptions1.C b/gcc/testsuite/g++.dg/eh/no-exceptions1.C new file mode 100644 index 00000000000..4b77064c646 --- /dev/null +++ b/gcc/testsuite/g++.dg/eh/no-exceptions1.C @@ -0,0 +1,19 @@ +// PR c++/107198 +// { dg-additional-options -fno-exceptions } + +struct A { + A() { throw 0; } // { dg-error disabled } + A(int i) { throw i; } + A(const A&) { throw 10; } +}; + +void try_idx (int i) +{ + int t = 10; + try { + struct X { + A e1[2], e2; + } + x2[3] = { { 1, 2, 3 }, { 4, 5, 6 } }; + } catch (int x) { t = x; } // { dg-prune-output "not declared" } +}