From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by sourceware.org (Postfix) with ESMTPS id 082753852208 for ; Fri, 18 Nov 2022 08:46:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 082753852208 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lf1-x134.google.com with SMTP id d6so7104394lfs.10 for ; Fri, 18 Nov 2022 00:46:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=KfxAjg9F0pdhUnQmJUztA7qhOo3U5fECkwwx0nJoiyw=; b=Sxz5/BdiCyM2SBw8j6pQqV41VxAn472ij+LZT8DJh/J/N709rMTykxLlRfGnukZ5eW br9NUGaiwC0/e7O9+OVayPCCsUbwp1eQBeEgLVLTLIi3F13w7y4rpziafHMHZbtxKaDL ToYbaG32tj8y/nuxui1QpDQp/W5ODd/TBzk4WrMuFyzIXCQ8lmRHAW8Sx2ja2t8wJjdh kjlSikOf/f1P00N5nlMuXdAcaRKdz2+WMB6CsCSCkCOEADJRwc/ilYG7GShpL7uRBz13 23/9Mex56oXFbUH4AGW9T7eEAuD/F1a7zsmq1HqpiwU6idL1IwZ/uyd0rOmcZy7EoedR fOIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=KfxAjg9F0pdhUnQmJUztA7qhOo3U5fECkwwx0nJoiyw=; b=bmNGIJHIrJ9XeeCm0Zo029JusgzVmV0jVVVh220Z+UtBVag7++Ly55Xg9uciDTYeAH DQtU5TlWQoT77Xlbkw1OinGTGsEa7McwWo9RrAkpWg8bIVJWozFe/1Tn3FJuheysH3y5 VJ6kIDk5BPmkrOZyi1yaTT9fhnMFGxK2dZGjZoxJZHSqYidgSmBjpCjfTolVVKr+fod1 ErGCfeXlJovRuR3IXP3ge6ZzFMNSeLuzO6G+d5ukheqO/YD2STv3c++vrPD/30uwQOgX 7T5sDtXKIbA8EXxvc0V5ClIWyLrIySLLku2EpOR3f5NzVxFNroqm8YXbg5DvK8r+fzbU VJbQ== X-Gm-Message-State: ANoB5pkHRx6G91p3/AX3mnwC/6UCpjkuWyn+69ZvpYyBJaXkWi98lOG8 7161LLE0o5Yr4AOa5pF65+Xd0NlOoc44i2BhhqQ= X-Google-Smtp-Source: AA0mqf7ke/FggSoWCrFtERKepQcLKJzPWJq8J71+bjimgZq/Wwycic2p34RDZCZvnFHS7/hEvN2AtuFfA6A1OxRqATk= X-Received: by 2002:a05:6512:e86:b0:4b4:70d9:5c02 with SMTP id bi6-20020a0565120e8600b004b470d95c02mr2074696lfb.27.1668761169324; Fri, 18 Nov 2022 00:46:09 -0800 (PST) MIME-Version: 1.0 References: <1668741911-1727-1-git-send-email-apinski@marvell.com> <1668741911-1727-2-git-send-email-apinski@marvell.com> In-Reply-To: <1668741911-1727-2-git-send-email-apinski@marvell.com> From: Richard Biener Date: Fri, 18 Nov 2022 09:45:57 +0100 Message-ID: Subject: Re: [PATCH 2/2] Fix PR middle-end/107705: ICE after reclaration error To: apinski@marvell.com Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: On Fri, Nov 18, 2022 at 4:26 AM apinski--- via Gcc-patches wrote: > > From: Andrew Pinski > > The problem here is after we created a call expression > in the C front-end, we replace the decl type with > an error mark node. We then end up calling > aggregate_value_p with the call expression > with the decl with the error mark as the type > and we ICE. > > The fix is to check the function type > after we process the call expression inside > aggregate_value_p to get it. > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. OK. > Thanks, > Andrew Pinski > > gcc/ChangeLog: > > PR middle-end/107705 > * function.cc (aggregate_value_p): Return 0 if > the function type was an error operand. > > gcc/testsuite/ChangeLog: > > * gcc.dg/redecl-22.c: New test. > --- > gcc/function.cc | 3 +++ > gcc/testsuite/gcc.dg/redecl-22.c | 9 +++++++++ > 2 files changed, 12 insertions(+) > create mode 100644 gcc/testsuite/gcc.dg/redecl-22.c > > diff --git a/gcc/function.cc b/gcc/function.cc > index 361aa5f7ed1..9c8773bbc59 100644 > --- a/gcc/function.cc > +++ b/gcc/function.cc > @@ -2090,6 +2090,9 @@ aggregate_value_p (const_tree exp, const_tree fntype) > if (VOID_TYPE_P (type)) > return 0; > > + if (error_operand_p (fntype)) > + return 0; > + > /* If a record should be passed the same as its first (and only) member > don't pass it as an aggregate. */ > if (TREE_CODE (type) == RECORD_TYPE && TYPE_TRANSPARENT_AGGR (type)) > diff --git a/gcc/testsuite/gcc.dg/redecl-22.c b/gcc/testsuite/gcc.dg/redecl-22.c > new file mode 100644 > index 00000000000..7758570fabe > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/redecl-22.c > @@ -0,0 +1,9 @@ > +/* We used to ICE in the gimplifier, PR 107705 */ > +/* { dg-do compile } */ > +/* { dg-options "-w" } */ > +int f (void) > +{ > + int (*p) (void) = 0; // { dg-note "" } > + return p (); > + int p = 1; // { dg-error "" } > +} > -- > 2.17.1 >