From patchwork Wed Nov 13 11:45:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 290897 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5895D2C009A for ; Wed, 13 Nov 2013 22:45:24 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:content-type; q=dns; s=default; b=k0K8qITFPq+xyITfbcemAwUfXYGhSpxPoAmoKSAnZf5 nrlx6Em1ViN9dMbBx0LzPl4Yg2WKBtRysM5SK6cje7x4WRcYTSt9uhiQQauoMenx nvZlAsxCwbLLDZDWxoLcRoHpZwGLyryktEc/4mcV5OLOsOJ26NHJ5eq98GjBEaKI = 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 :message-id:date:from:mime-version:to:cc:subject:content-type; s=default; bh=MK0yh6csPSYqMxqHfpDusetYWnY=; b=eGvZjnI8MFZoNdSY4 IdxuA7qNuQIBat4kLxxY7gQweuD94jr2Ql00fcuBpfhfAJKdiOOZnV+2g75oQZ/f 5zrtd02QDgzjk15LjO1mZh/7gQzs479qgyqmZCif9OUQ9ipL9yX/BE/WaySYXD0m Z5EVYfBQbau8ZfoGu+TIaXWUBM= Received: (qmail 9477 invoked by alias); 13 Nov 2013 11:45:14 -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 9468 invoked by uid 89); 13 Nov 2013 11:45:13 -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_50, RDNS_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: aserp1040.oracle.com Received: from Unknown (HELO aserp1040.oracle.com) (141.146.126.69) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 13 Nov 2013 11:45:12 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rADBj4Gj019286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 13 Nov 2013 11:45:04 GMT Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rADBj3QT002793 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 13 Nov 2013 11:45:03 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rADBj3Tq002783; Wed, 13 Nov 2013 11:45:03 GMT Received: from poldo4.casa (/79.46.231.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 13 Nov 2013 03:45:02 -0800 Message-ID: <5283663D.7080801@oracle.com> Date: Wed, 13 Nov 2013 12:45:01 +0100 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] Fixes for two recent minor regressions (PR c++/59080, c++/59096) X-IsSubscribed: yes Hi, in the first one we pass a NULL_TREE to unify_array_domain: I think the right fix is simply not calling the function, as we do elsewhere. In the second, we forget to check that TREE_VALUE isn't NULL_TREE and we crash in the body of the conditional. Tested x86_64-linux. Thanks, Paolo. ////////////////////// /cp 2013-11-13 Paolo Carlini PR c++/59080 * pt.c (unify): Don't call unify_array_domain with a NULL_TREE third argument. PR c++/59096 * pt.c (apply_late_template_attributes): Check that TREE_VALUE isn't NULL_TREE in the attribute_takes_identifier_p case. /testsuite 2013-11-13 Paolo Carlini PR c++/59080 * g++.dg/cpp0x/initlist75.C: New. PR c++/59096 * g++.dg/cpp0x/gen-attrs-57.C: New. Index: cp/pt.c =================================================================== --- cp/pt.c (revision 204734) +++ cp/pt.c (working copy) @@ -8613,7 +8613,8 @@ apply_late_template_attributes (tree *decl_p, tree pass it through tsubst. Attributes like mode, format, cleanup and several target specific attributes expect it unmodified. */ - else if (attribute_takes_identifier_p (get_attribute_name (t))) + else if (attribute_takes_identifier_p (get_attribute_name (t)) + && TREE_VALUE (t)) { tree chain = tsubst_expr (TREE_CHAIN (TREE_VALUE (t)), args, complain, @@ -17196,8 +17197,9 @@ unify (tree tparms, tree targs, tree parm, tree ar /* Also deduce from the length of the initializer list. */ tree max = size_int (CONSTRUCTOR_NELTS (arg)); tree idx = compute_array_index_type (NULL_TREE, max, tf_none); - return unify_array_domain (tparms, targs, TYPE_DOMAIN (parm), - idx, explain_p); + if (TYPE_DOMAIN (parm) != NULL_TREE) + return unify_array_domain (tparms, targs, TYPE_DOMAIN (parm), + idx, explain_p); } /* If the std::initializer_list deduction worked, replace the Index: testsuite/g++.dg/cpp0x/gen-attrs-57.C =================================================================== --- testsuite/g++.dg/cpp0x/gen-attrs-57.C (revision 0) +++ testsuite/g++.dg/cpp0x/gen-attrs-57.C (working copy) @@ -0,0 +1,9 @@ +// PR c++/59096 +// { dg-do compile { target c++11 } } + +template struct A +{ + typedef T B [[mode]]; // { dg-warning "ignored" } +}; + +A::B b; Index: testsuite/g++.dg/cpp0x/initlist75.C =================================================================== --- testsuite/g++.dg/cpp0x/initlist75.C (revision 0) +++ testsuite/g++.dg/cpp0x/initlist75.C (working copy) @@ -0,0 +1,6 @@ +// PR c++/59080 +// { dg-require-effective-target c++11 } + +#include + +auto foo[] = {}; // { dg-error "auto|unable to deduce" }