From patchwork Mon Aug 21 12:35:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 803988 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-460635-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="cuxBIBnZ"; 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 3xbY7F2bXhz9sCZ for ; Mon, 21 Aug 2017 22:35:20 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:to:cc :from:subject:message-id:date:mime-version:content-type; q=dns; s=default; b=fOVmBzJmF741CO2n7TMg+wSVT0VczLBPnoempVB0O0I0xyL17/ zOnogokfxbcjARYrjJumKu3NkplTLSJWTAfaboEE/CdzBhrJXThDG2wGMlBwNruV DVy4wiW6sBpZMEsKlV1CayULntbaESesHEAxRsnFyfVEQKMF3plNV9yYI= 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:cc :from:subject:message-id:date:mime-version:content-type; s= default; bh=xRVMkrgQ5zRoDB/oYkEjcnUV6gw=; b=cuxBIBnZV7bfy2biUpZF FbDE6Qe8L14tC047wrNFLHxsI72lAmd+74aL39tg8rRDaC7Ya0R7Q1gFAuCDi7ZJ mAvCHaOVboidLthJIYEZ0G/EMZ0pwXnBtaw8paiMm8PvCTFvk6Ii5lgzivWJnYgO 3R/x8AQtopVmtt6Xq2a5Yc4= Received: (qmail 64145 invoked by alias); 21 Aug 2017 12:35:13 -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 64127 invoked by uid 89); 21 Aug 2017 12:35:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=fir X-HELO: mo4-p00-ob.smtp.rzone.de Received: from mo4-p00-ob.smtp.rzone.de (HELO mo4-p00-ob.smtp.rzone.de) (81.169.146.161) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Aug 2017 12:35:08 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT3ol15ykJcYwTPLBCxG2NAI0FdGO X-RZG-CLASS-ID: mo00 Received: from [192.168.0.123] (ip5f585828.dynamic.kabel-deutschland.de [95.88.88.40]) by smtp.strato.de (RZmta 41.3 DYNA|AUTH) with ESMTPSA id z0b9fat7LCZ51b3 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Mon, 21 Aug 2017 14:35:05 +0200 (CEST) To: gcc-patches Cc: Denis Chertykov From: Georg-Johann Lay Subject: [patch,avr] Fir PR91910: ICE for bad attribute "address". Message-ID: <369a3ac9-88d6-cb43-0d8a-43d66f67c8b3@gjlay.de> Date: Mon, 21 Aug 2017 14:35:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 X-IsSubscribed: yes "address" attribute only must be specified with VARs, yet the compiler dived into attribute analysis for non-VARs, resulting in ICE. This patch also adds OPT_Wattributes as warning filter. Ok to apply? Johann gcc/ PR target/81910 * config/avr/avr.c (avr_handle_addr_attribute): Early return if not VAR_P. Filter attribute warnings with OPT_Wattributes. (avr_attribute_table) : Initialize .decl_required with true. Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 251142) +++ config/avr/avr.c (working copy) @@ -9790,10 +9790,12 @@ avr_handle_addr_attribute (tree *node, t bool io_p = (strncmp (IDENTIFIER_POINTER (name), "io", 2) == 0); location_t loc = DECL_SOURCE_LOCATION (*node); - if (TREE_CODE (*node) != VAR_DECL) + if (!VAR_P (*node)) { - warning_at (loc, 0, "%qE attribute only applies to variables", name); + warning_at (loc, OPT_Wattributes, "%qE attribute only applies to " + "variables", name); *no_add = true; + return NULL_TREE; } if (args != NULL_TREE) @@ -9803,8 +9805,8 @@ avr_handle_addr_attribute (tree *node, t tree arg = TREE_VALUE (args); if (TREE_CODE (arg) != INTEGER_CST) { - warning (0, "%qE attribute allows only an integer constant argument", - name); + warning_at (loc, OPT_Wattributes, "%qE attribute allows only an " + "integer constant argument", name); *no_add = true; } else if (io_p @@ -9813,19 +9815,20 @@ avr_handle_addr_attribute (tree *node, t ? low_io_address_operand : io_address_operand) (GEN_INT (TREE_INT_CST_LOW (arg)), QImode))) { - warning_at (loc, 0, "%qE attribute address out of range", name); + warning_at (loc, OPT_Wattributes, "%qE attribute address " + "out of range", name); *no_add = true; } else { tree attribs = DECL_ATTRIBUTES (*node); - const char *names[] = { "io", "io_low", "address", NULL } ; + const char *names[] = { "io", "io_low", "address", NULL }; for (const char **p = names; *p; p++) { tree other = lookup_attribute (*p, attribs); if (other && TREE_VALUE (other)) { - warning_at (loc, 0, + warning_at (loc, OPT_Wattributes, "both %s and %qE attribute provide address", *p, name); *no_add = true; @@ -9836,7 +9839,8 @@ avr_handle_addr_attribute (tree *node, t } if (*no_add == false && io_p && !TREE_THIS_VOLATILE (*node)) - warning_at (loc, 0, "%qE attribute on non-volatile variable", name); + warning_at (loc, OPT_Wattributes, "%qE attribute on non-volatile variable", + name); return NULL_TREE; } @@ -9886,11 +9890,11 @@ avr_attribute_table[] = false }, { "OS_main", 0, 0, false, true, true, avr_handle_fntype_attribute, false }, - { "io", 0, 1, false, false, false, avr_handle_addr_attribute, + { "io", 0, 1, true, false, false, avr_handle_addr_attribute, false }, - { "io_low", 0, 1, false, false, false, avr_handle_addr_attribute, + { "io_low", 0, 1, true, false, false, avr_handle_addr_attribute, false }, - { "address", 1, 1, false, false, false, avr_handle_addr_attribute, + { "address", 1, 1, true, false, false, avr_handle_addr_attribute, false }, { "absdata", 0, 0, true, false, false, avr_handle_absdata_attribute, false },