From patchwork Sun Sep 25 09:08:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 674558 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 3shh9W0ph2z9s4n for ; Sun, 25 Sep 2016 19:09:00 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=QpV78+pe; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=PtLWRcKE7AY2lhY/6YGBSppNpmz+2gdOehyTuDc280mIPgl7Ih LoHSck3XFDG2mC9d/0jnHAjzDkRoMF6gxvSvokDsw+SP7OMqyogzuCa5xGEV8amU 4a9Ao5ZSV+0qvG/OQr6LjmFI8Lqq7WMIKtL8zDie+9PyIdxROFzB8hK3w= 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:to :from:subject:message-id:date:mime-version:content-type; s= default; bh=n+4AbYnHNv3VEzHMiSki48i+uU4=; b=QpV78+pepO/TKjL89fPi vBSIKienXXIZvY2CguQBTW9pC2yUenW0h2WIU5rVSC804j5NaQr1AopuoJnkdSjA Q4Y+fCDDqZ257W4QL6b6+oPkmC9TtJmIYeFPE1L7jWpOvvFK0rdjNY7Aox5Fdnwv cwzNYOnnrZmbeCXnBHQKPY4= Received: (qmail 29902 invoked by alias); 25 Sep 2016 09:08:52 -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 29875 invoked by uid 89); 25 Sep 2016 09:08:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy=2016-09-25, Treat, pap X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 25 Sep 2016 09:08:39 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1bo5QJ-0001J2-Fo from Tom_deVries@mentor.com for gcc-patches@gcc.gnu.org; Sun, 25 Sep 2016 02:08:35 -0700 Received: from [127.0.0.1] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Sun, 25 Sep 2016 10:08:31 +0100 To: GCC Patches From: Tom de Vries Subject: [PATCH, PR77558] Remove RECORD_TYPE special-casing in std_canonical_va_list_type Message-ID: <2908590d-f799-7053-9f52-2f0b65803c4e@mentor.com> Date: Sun, 25 Sep 2016 11:08:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Hi, this patch fixes PR77558, an ice-on-invalid-code 6/7 regression. The fix for PR71602 introduced the invalid-code test-case c-c++-common/va-arg-va-list-type.c: ... __builtin_va_list *pap; void fn1 (void) { __builtin_va_arg (pap, double); /* { dg-error "first argument to 'va_arg' not of type 'va_list'" } */ } ... The test-case passes for x86_64, but fails for aarch64 and ICEs for arm. The ICE happens because the patch for PR71602 is incomplete. The patch tries to be more strict about returning a canonical va_list only for actual va_lists, but doesn't implement this for structure va_list types, such as we have for arm, aarch64 and alpha. This patch adds the missing part, and fixes the ICE. OK for trunk, 6-branch? Thanks, - Tom Remove RECORD_TYPE special-casing in std_canonical_va_list_type 2016-09-25 Tom de Vries PR middle-end/77558 * builtins.c (std_canonical_va_list_type): Remove RECORD_TYPE special-casing. --- gcc/builtins.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/gcc/builtins.c b/gcc/builtins.c index 9a19a75..f91e6d3 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -4089,10 +4089,8 @@ std_canonical_va_list_type (tree type) wtype = va_list_type_node; htype = type; - /* Treat structure va_list types. */ - if (TREE_CODE (wtype) == RECORD_TYPE && POINTER_TYPE_P (htype)) - htype = TREE_TYPE (htype); - else if (TREE_CODE (wtype) == ARRAY_TYPE) + + if (TREE_CODE (wtype) == ARRAY_TYPE) { /* If va_list is an array type, the argument may have decayed to a pointer type, e.g. by being passed to another function.