From patchwork Wed Jan 2 10:09:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1019948 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-493260-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="B5X4Xs6a"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43V6Gk5TSSz9rxp for ; Wed, 2 Jan 2019 21:09:33 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=RY/n5f3yKvUJ93FMvYj6Jc30T+f48 /Opdp+tG9FMYGcjD1L9knk3dsBnp27N1FDH3jRCE0JigQORaNlnaRvEICzLdfgdc vpjboNKqWTFtXU8HCBt0LufXxPauDX90eZ9rsm4hAL1NgOvvCoWw8VVKISywWUkr +/pSQjUMInPpvM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=a1gviQH20t1zyEP8L+0KXO19swI=; b=B5X 4Xs6aIBNRnJgfklqPcjOxygf+oJC17XZSlpnZUpX/ySPXlNetUMP3XwMT/GCu6rs nCnxvbOwa3vSXqTTJUVIA+hIHfjX5kbKUINKVkwezc190jS+5T41MZQ8Ao1WlXHI uPxiL9fLvfo8PlryAm+e18xj9Cs8ZsDyPSKahP3A= Received: (qmail 102384 invoked by alias); 2 Jan 2019 10:09:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 102368 invoked by uid 89); 2 Jan 2019 10:09:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Jan 2019 10:09:24 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8E2AA83F44 for ; Wed, 2 Jan 2019 10:09:23 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-18.ams2.redhat.com [10.36.116.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3178E101963D; Wed, 2 Jan 2019 10:09:23 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id x02A9Le9029751; Wed, 2 Jan 2019 11:09:21 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id x02A9KA5029750; Wed, 2 Jan 2019 11:09:20 +0100 Date: Wed, 2 Jan 2019 11:09:19 +0100 From: Jakub Jelinek To: Jason Merrill Cc: gcc-patches@gcc.gnu.org Subject: [C++ PATCH] Fix ICEs with builtin redeclaration (PR c++/88636) Message-ID: <20190102100919.GH30353@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi! On the following testcase we ICE, because pushdecl* ggc_frees the decl passed to it, but builtin_function_1 returns it anyway. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2019-01-02 Jakub Jelinek PR c++/88636 * decl.c (builtin_function_1): Return result of pushdecl_top_level or pushdecl rather than decl. * g++.target/i386/pr88636.C: New test. Jakub --- gcc/cp/decl.c.jj 2018-12-20 08:50:29.682444440 +0100 +++ gcc/cp/decl.c 2018-12-30 22:28:36.012759687 +0100 @@ -4536,11 +4536,9 @@ builtin_function_1 (tree decl, tree cont } if (is_global) - pushdecl_top_level (decl); + return pushdecl_top_level (decl); else - pushdecl (decl); - - return decl; + return pushdecl (decl); } tree --- gcc/testsuite/g++.target/i386/pr88636.C.jj 2018-12-31 10:11:18.224723703 +0100 +++ gcc/testsuite/g++.target/i386/pr88636.C 2018-12-31 10:10:58.253050173 +0100 @@ -0,0 +1,6 @@ +// PR c++/88636 +// { dg-do compile } +// { dg-options "-msse2 -mno-sse3 -fno-exceptions --param ggc-min-heapsize=0" } + +extern unsigned int __builtin_ia32_crc32si (unsigned int, unsigned int); +#pragma GCC target("sse4.2")