From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 4D9B83858412 for ; Mon, 14 Feb 2022 15:32:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 4D9B83858412 Received: by mail-ej1-x631.google.com with SMTP id p9so15350756ejd.6 for ; Mon, 14 Feb 2022 07:32:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0cogZrc1SKRGdH2OABDZ5Dr6FPvxFqCX0vilqosdo0g=; b=D5KvrQGMJkbDkUlsI7cfQ6uQBqHSXAaGDBP0hCb7hBNp/G/bce/dMY7KCP1bwoWsdC REYFP19QZ2E4FWVNISxxNDG0tnJKxDqQy6VhobwLmgOjDWUwTf7gF2s0GCoaPlbBqDXg qPC5tt+gCeQ2FZ0Ecl8al/yE7O2WGfo2UriXKXcPZ/Ji5HOAtt/KrUh09PuovzK4zzR2 fqWc9RKNsdSTILBdZ6ItqloTybFIXyANs2XmGcGOaQQJfYKI/qo8ztXwb5X5BTDNiZJk zlhz+iTTPvKuchdLv2tbIwjHkDDSKZlq6X73FPPTZM6c8U7Zz+Rw8T/tXEl6P49oPb4M 9mXg== X-Gm-Message-State: AOAM531VcvyYNoMI0WtrP6UsFDvaMLuEsd6vjkc33JE5MsacDVb2uIey XurA/xjoGQ79ssoDmyrFY0+x1udATN5oblLWXkM= X-Google-Smtp-Source: ABdhPJywEE3+jF6WUBeeuPqorEFIfHx61VEUw9j4IdmikjQF7ONfySTGlzMFGZ4G+79ZsB0fciBOnrLM5buy4l28Wf0= X-Received: by 2002:a17:907:1b1c:: with SMTP id mp28mr104228ejc.624.1644852729964; Mon, 14 Feb 2022 07:32:09 -0800 (PST) MIME-Version: 1.0 References: <00c501d821a1$fbcf55b0$f36e0110$@nextmovesoftware.com> In-Reply-To: <00c501d821a1$fbcf55b0$f36e0110$@nextmovesoftware.com> From: Richard Biener Date: Mon, 14 Feb 2022 16:31:58 +0100 Message-ID: Subject: Re: [PATCH] PR c/104506: Tolerate error_mark_node in useless_type_conversion_p. To: Roger Sayle Cc: GCC Patches Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Mon, 14 Feb 2022 15:32:12 -0000 On Mon, Feb 14, 2022 at 1:54 PM Roger Sayle wrote: > > > > This simple fix to the middle-end, resolves PR c/104506, by adding an > > explicit check for error_mark_node to useless_type_conversion_p. I first > > trying fixing this in the C front-end, but the type is valid at the point > > that the NOP_EXPR is created, so the poisoned type leaks to the middle-end. Hmm, IMHO "fixing" something to error_mark after it has possibly be used looks broken. I don't like trying to paper over this in useless_type_conversion_p, the predicate should not be called on an error_mark_node type. Alternatively we might want to create an error_type_node that is at least a type (with main variant error_type_node and TREE_CODE ERROR_TYPE, etc.). But likely more complicated than avoiding to mess with the type of 'x' after the fact? Richard. > > Returning either true or false from useless_type_conversion_p avoids the > > ICE-after-error. Apologies to Andrew Pinski, I hadn't noticed that he'd > > assigned this PR to himself until after my regression testing had finished. > > > > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap and > > make -k check with no new failures. Ok for mainline? > > > > > > 2022-02-14 Roger Sayle > > > > gcc/ChangeLog > > PR c/104506 > > * gimple-expr.cc (useless_type_conversion_p): Add a check for > > error_mark_node. > > > > gcc/testsuite/ChangeLog > > PR c/104506 > > * gcc.dg/pr104506.c: New test case. > > > > > > Roger > > -- > > >