From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id 51BF738A909C for ; Mon, 21 Nov 2022 07:27:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 51BF738A909C 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-x12b.google.com with SMTP id d6so17507795lfs.10 for ; Sun, 20 Nov 2022 23:27:08 -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=6Ao7hFhmJeMqWjceZE1WsV15qYhjqf0cIi/VJ12QNmI=; b=Vk/78CvBVW3bB7ioRRL3O/uY3k0AZIq5IOJzCiL6In0cfUzjT6iLy6tZ3LJ9DJ2Guo asQPIHE94aG7yHgy20BunkBvSnxKjjAb8JFrkQrrD8wswuhq1mSQDaxLTJCu80aAJ7E4 kiN9bgBeDP9hug9u8EHqU9MvZTQ2P34lMDDGpkpRGYi18fHhY1txqcr/E5wwN3mFNz4M Um4OyMj+9oT4V2G5eJXiPWqjFDuXtF63PrXa7XLxwzTW6ozipmXizO7MahgYtTKq5Nzn D2OK09I/6/6HA2srPTd9GC6Hp1NX7vbozPgyOXRh1d97ecQ38YE3AMeZioI4pxu9kYvL KQww== 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=6Ao7hFhmJeMqWjceZE1WsV15qYhjqf0cIi/VJ12QNmI=; b=IvSUVKbhfTlXoUHd+ZjtB4mSpvyGybOGbnWtjDjA24HoZssmFj6ee2+A6g6YQphRVi 2DFRjLAQhJCbPE8vmyFLoe9CKzBm+JJ5DokZm6135Rn986dfD3xL4xAtmPx8VDOrLpuB S/34eIl1wnhT3zysUGjiminXkyx5DiOXnwR2o9DKxN42Mr/vM/I4wV2x7PnymJ+/XrNu 6NUHAuOuFgrrM2nbtjHOB5M/7MHLs5ikIQEDSbPzXJmd4IFBie6biBs36r2CYRn57CQb DqCHy8SmgF7ldZhnXuYE7KIgzmboRk++YVbsIRB6w3MR0TMum1hWovciIDu38UKaY0vn Y7Ig== X-Gm-Message-State: ANoB5pl1JEj7rKqSZh2pb4whwLpa0znORaygN1CrzPjBBt9oQxUjwroS IYJLBtljJapI+nu2NxARhM74oJM9ymuHDagzlFw= X-Google-Smtp-Source: AA0mqf6Tipudzayx6qZgzYAFMWrl2LsJWznjkhUFLji/ZSMNl7lzi3P37cAvCYGeKfg+TrMNc/6A3UIFncDi568S1rE= X-Received: by 2002:a19:7111:0:b0:499:b4b3:2f68 with SMTP id m17-20020a197111000000b00499b4b32f68mr5299559lfc.203.1669015626563; Sun, 20 Nov 2022 23:27:06 -0800 (PST) MIME-Version: 1.0 References: <1668907504-29652-1-git-send-email-apinski@marvell.com> In-Reply-To: <1668907504-29652-1-git-send-email-apinski@marvell.com> From: Richard Biener Date: Mon, 21 Nov 2022 08:26:53 +0100 Message-ID: Subject: Re: [PATCH] Fix PR 106560: Another ICE after conflicting types of redeclaration To: apinski@marvell.com Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 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 Sun, Nov 20, 2022 at 2:26 AM apinski--- via Gcc-patches wrote: > > From: Andrew Pinski > > This another one of these ICE after error issues with the > gimplifier and a fallout from r12-3278-g823685221de986af. > The problem here is gimplify_modify_expr does not > check if either from or to was an error operand. > This adds the check and fixes the ICE. > > OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. OK. > gcc/ChangeLog: > > * gimplify.cc (gimplify_modify_expr): If > either *from_p or *to_p were error_operand > return early. > > gcc/testsuite/ChangeLog: > > * gcc.dg/redecl-23.c: New test. > * gcc.dg/redecl-24.c: New test. > * gcc.dg/redecl-25.c: New test. > --- > gcc/gimplify.cc | 3 +++ > gcc/testsuite/gcc.dg/redecl-23.c | 6 ++++++ > gcc/testsuite/gcc.dg/redecl-24.c | 6 ++++++ > gcc/testsuite/gcc.dg/redecl-25.c | 9 +++++++++ > 4 files changed, 24 insertions(+) > create mode 100644 gcc/testsuite/gcc.dg/redecl-23.c > create mode 100644 gcc/testsuite/gcc.dg/redecl-24.c > create mode 100644 gcc/testsuite/gcc.dg/redecl-25.c > > diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc > index c62a966e918..02415cb1b5c 100644 > --- a/gcc/gimplify.cc > +++ b/gcc/gimplify.cc > @@ -6054,6 +6054,9 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, > location_t loc = EXPR_LOCATION (*expr_p); > gimple_stmt_iterator gsi; > > + if (error_operand_p (*from_p) || error_operand_p (*to_p)) > + return GS_ERROR; > + > gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR > || TREE_CODE (*expr_p) == INIT_EXPR); > > diff --git a/gcc/testsuite/gcc.dg/redecl-23.c b/gcc/testsuite/gcc.dg/redecl-23.c > new file mode 100644 > index 00000000000..425721df2ff > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/redecl-23.c > @@ -0,0 +1,6 @@ > +/* We used to ICE in the gimplifier, PR 106560. */ > +/* { dg-do compile } */ > +/* { dg-options "-w" } */ > +void **a; /* { dg-note "" } */ > +void b() { void **c = a; } > +a; /* { dg-error "" } */ > diff --git a/gcc/testsuite/gcc.dg/redecl-24.c b/gcc/testsuite/gcc.dg/redecl-24.c > new file mode 100644 > index 00000000000..f0f7a723ab8 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/redecl-24.c > @@ -0,0 +1,6 @@ > +/* We used to ICE in the gimplifier, PR 106560 */ > +/* { dg-do compile } */ > +/* { dg-options "-w" } */ > +void **a, **b; /* { dg-note "" } */ > +c(){b = a;} > +a = /* { dg-error "" } */ > diff --git a/gcc/testsuite/gcc.dg/redecl-25.c b/gcc/testsuite/gcc.dg/redecl-25.c > new file mode 100644 > index 00000000000..4232e19d9a7 > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/redecl-25.c > @@ -0,0 +1,9 @@ > +/* We used to ICE in the gimplifier, PR 106560 */ > +/* { dg-do compile } */ > +/* { dg-options "-w" } */ > +void **a; /* { dg-note "" } */ > +void b() { > + void **c; > + c = a /* { dg-error "" } */ > +} > +a; /* { dg-error "" } */ > -- > 2.27.0 >