From patchwork Tue Feb 21 16:40:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 730683 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 3vSR7m55Lmz9s2Q for ; Wed, 22 Feb 2017 03:40:36 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="CPgfuWeC"; 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:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=kZ6mUWn8OwZNhEMyvsVLHgagSeJsX VKrDUY8MiVVLmzckMG5y2ZyGaHtwwhR7nzNN1xG5ljkqjme3uIzxEahugfkw/3Ic 0+E+lcldM7WMZ1Tco3YZO69PPqumN6lMWEn5kyJnkcmLcexAjZ3eRW7Mg4XO7Tmv B18FPoaf81Xnqw= 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=Oh72V6/TEVCmAAaAA/hcLEXuDx8=; b=CPg fuWeCj2ELFokKmH3Tj6XwKhSk1undL/jQ3m+X/cwu9neZ3+yyzj/vo5L4+r1HBoe j5oVj925ZcJSCO1bzqs+MWj/WDle7rqwhqzIMC6Iu1E2xhO/BUTGArDPWLt37amp J7iGgPetGjGoAzx7KC19XGgdJSOdR1mPLN7T5PzE= Received: (qmail 33831 invoked by alias); 21 Feb 2017 16:40:28 -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 33801 invoked by uid 89); 21 Feb 2017 16:40:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, 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; Tue, 21 Feb 2017 16:40:26 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3FEFB61BAC; Tue, 21 Feb 2017 16:40:26 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-76.ams2.redhat.com [10.36.117.76]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1LGeOr8008431 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Feb 2017 11:40:25 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id v1LGeLv9017154; Tue, 21 Feb 2017 17:40:22 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id v1LGeKug017153; Tue, 21 Feb 2017 17:40:20 +0100 Date: Tue, 21 Feb 2017 17:40:19 +0100 From: Jakub Jelinek To: Jason Merrill , "Joseph S. Myers" , Marek Polacek Cc: gcc-patches@gcc.gnu.org Subject: [C/C++ PATCH] Fix mode attribute handling (PR c++/79641) Message-ID: <20170221164019.GS1849@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes Hi! On the following testcase, we have TYPE_READONLY integer type before handling the mode attribute and transform it into a signed char type (without TYPE_READONLY), which causes ICE in the FE, because it isn't const anymore. Fixed by making sure we have the same quals as before applying the mode attribute. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2017-02-21 Jakub Jelinek PR c++/79641 * c-attribs.c (handle_mode_attribute): Use build_qualified_type to preserve quals. * c-c++-common/pr79641.c: New test. Jakub --- gcc/c-family/c-attribs.c.jj 2017-01-01 12:45:46.000000000 +0100 +++ gcc/c-family/c-attribs.c 2017-02-21 12:38:10.105547005 +0100 @@ -1430,7 +1430,7 @@ handle_mode_attribute (tree *node, tree return NULL_TREE; } - *node = typefm; + *node = build_qualified_type (typefm, TYPE_QUALS (type)); } return NULL_TREE; --- gcc/testsuite/c-c++-common/pr79641.c.jj 2017-02-21 12:43:24.246466684 +0100 +++ gcc/testsuite/c-c++-common/pr79641.c 2017-02-21 12:43:18.132546096 +0100 @@ -0,0 +1,4 @@ +/* PR c++/79641 */ +/* { dg-do compile } */ + +const int __attribute__((__mode__ (__QI__))) i = 0;