From patchwork Mon May 23 18:58:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 625357 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 3rD79M0pnGz9sdm for ; Tue, 24 May 2016 04:58:29 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=x/J8/OJf; 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:cc:message-id:date:mime-version:content-type; q= dns; s=default; b=et6/dqay3/dgdlCF2aQ9Nme89zIyqhmh1/OQ+uR+Q4mFWM aiSO6M6Ke9MZd9mofwAEXL+Q0qZtBpYrL4d2Yive/IdPh/Wmbp3XAHXC4EOMrc+M n2nu9nQI+uzbNQ0c/CuVzxXQ4+1PTj9o+nnQgt2H9dGU0GrpAoiw9ruOMfPPw= 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:cc:message-id:date:mime-version:content-type; s= default; bh=RjgYSBg/LuPDRp8CQAgqTPCyS/A=; b=x/J8/OJfE/tr3n4LVI3V 11xkdunvrDyZzNbGpuFGEyX6+42bEJwrPau84VmQq4RqjuJcHP67lxqkmMokixLQ 968gL7S9T/cylxKL6JhuBfIEs0UjDFPwmbes/eGcImdb9FhvRPAEV6KWu61fzqSM WSYj/rkvJPILNq4ZAooNg4g= Received: (qmail 105226 invoked by alias); 23 May 2016 18:58:20 -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 105207 invoked by uid 89); 23 May 2016 18:58:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=U*jason, H*Ad:U*patrick, jasonredhatcom, sk:jasonr X-HELO: mail-qk0-f182.google.com Received: from mail-qk0-f182.google.com (HELO mail-qk0-f182.google.com) (209.85.220.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 23 May 2016 18:58:16 +0000 Received: by mail-qk0-f182.google.com with SMTP id n63so114769141qkf.0 for ; Mon, 23 May 2016 11:58:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:cc:message-id:date:user-agent :mime-version; bh=wLgRk1cohC6GhNwPzYUm2d6P0Mi4lDvA4ZPY3gdymqI=; b=CTKxhLB6tjD/d2mCCNOcMF4HwP7Q1tXUqh6LFGjXCNYDLdOW5ZffTDD0SXEWJfYIYX H/6Xy2YBsHOFaU7W0WiFm9diQu/z6h7jZKUdDEqhoc4xDJAdSkgGnrRZRT4HhGUflnJi LSUb4Ct6u+Njyyk7qGEtSIjzaaYsJtWYwlFoNEZgLz3mI0WVSlmsf1oVLs4o3SAVqXQZ md6Dd6KpYXbbe4kZPfCubGamjxUPrNP3BSeeUKLwhyjtcbizKrwPPeAHtMrWf/leuidg B7IDOksR+gYa6FVkR789Q4wJELh3sjlJTyRzmyDMQguXlE7nIa3BpQTq5bFK2wbUXp7z FeAA== X-Gm-Message-State: ALyK8tLeNLSmdxkC9hbQ31tapx/uMYc82xZj1NRjOwYod/S/0MZstbW11AJtdDogO0JQZ4Dj X-Received: by 10.237.53.100 with SMTP id b33mr378665qte.59.1464029893865; Mon, 23 May 2016 11:58:13 -0700 (PDT) Received: from [192.168.1.50] (209-6-90-240.c3-0.smr-ubr1.sbo-smr.ma.cable.rcn.com. [209.6.90.240]) by smtp.gmail.com with ESMTPSA id y12sm6652384qhy.32.2016.05.23.11.58.12 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 May 2016 11:58:13 -0700 (PDT) To: gcc-patches List From: Jason Merrill Subject: C++ PATCH for c++/70584 (parenthesized argument to x86 builtin) Cc: Patrick Palka , Daniel Gutson , Andres Tiraboschi Message-ID: <1d5430ea-4d5d-0fb1-aa11-695af802c472@redhat.com> Date: Mon, 23 May 2016 14:58:12 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 X-IsSubscribed: yes The C++14 decltype(auto) obfuscation was confusing the x86 builtin; it's a simple matter to undo it during delayed folding, thanks to the maybe_undo_parenthesized_ref function that Patrick recently introduced. Tested x86_64-pc-linux-gnu, applying to trunk. commit d8cfb8653df9583386a9825809dfdfa5e8d99759 Author: Jason Merrill Date: Fri May 20 17:21:51 2016 -0400 PR c++/70584 - error with parenthesized builtin arg * cp-gimplify.c (cp_fold) [INDIRECT_REF]: Call maybe_undo_parenthesized_ref. diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index aaa2db2..57f5d35 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1996,6 +1996,15 @@ cp_fold (tree x) break; + case INDIRECT_REF: + /* We don't need the decltype(auto) obfuscation anymore. */ + if (REF_PARENTHESIZED_P (x)) + { + tree p = maybe_undo_parenthesized_ref (x); + return cp_fold_maybe_rvalue (p, rval_ops); + } + goto unary; + case ADDR_EXPR: case REALPART_EXPR: case IMAGPART_EXPR: @@ -2008,7 +2017,7 @@ cp_fold (tree x) case BIT_NOT_EXPR: case TRUTH_NOT_EXPR: case FIXED_CONVERT_EXPR: - case INDIRECT_REF: + unary: loc = EXPR_LOCATION (x); op0 = cp_fold_maybe_rvalue (TREE_OPERAND (x, 0), rval_ops); diff --git a/gcc/testsuite/g++.dg/other/i386-10.C b/gcc/testsuite/g++.dg/other/i386-10.C new file mode 100644 index 0000000..96def72 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/i386-10.C @@ -0,0 +1,12 @@ +// { dg-do compile { target i?86-*-* x86_64-*-* } } +// { dg-options -maes } + +typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__)); + +int main() +{ + const char index = 1; + __m128i r = { }; + + r = __builtin_ia32_aeskeygenassist128 (r, (int)(index)); +}