From patchwork Sun Nov 13 18:20:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 81966 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp692092qge; Sun, 13 Nov 2016 10:21:33 -0800 (PST) X-Received: by 10.99.164.9 with SMTP id c9mr63111857pgf.141.1479061293546; Sun, 13 Nov 2016 10:21:33 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id e72si19286284pfl.77.2016.11.13.10.21.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Nov 2016 10:21:33 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-441255-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-441255-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-441255-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=nDuvUWttMIJ3oUv/ eFb71eWvtfAulaEx/BTcgfK3ctwnpUJCfazcf4AQ6wJL+0D9tBuzvB69eRpbV6r5 oMBRBdehDPeqJH4XcRtLjNG0EjBgB2NO8hN9OkY6+xHVr8OGsBcTXtTZO+zz7Ae2 QmX1U7V2qyqau8oUhyHvk1ocvXg= 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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=UqZVjEZNBS9pKoIUGqi4tJ Vxj+w=; b=lEQRMByuDAZd3DwNBbnkprZ9ksxlTvyamE0xpGGKgb5stApoOTEAY6 LRwIXdXrreun6si/Z38rwtVpoEv6GwQviKnxm02P0ItWjDG6N9249oGZgj1EWS/q GispFap3rVHKce+kvlEEKKddL2ZyKoQMQle2IDImep1siA6u/l4Wc= Received: (qmail 58582 invoked by alias); 13 Nov 2016 18:21:19 -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 58570 invoked by uid 89); 13 Nov 2016 18:21:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1114, Deal, 80226 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 13 Nov 2016 18:21:08 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id AF25E812EB for ; Sun, 13 Nov 2016 19:21:06 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IRyr9r5T-tiU for ; Sun, 13 Nov 2016 19:21:06 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 8CE1B812E9 for ; Sun, 13 Nov 2016 19:21:06 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Correctly annotate negative values for the front-end Date: Sun, 13 Nov 2016 19:20:59 +0100 Message-ID: <1496279.mVPCX8eUif@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-48-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 gigi cannot back-annotate negative values in expressions for the front-end directly because only non-negative values are supported directly. Fixed thusly, tested on x86_64-suse-linux, applied on the mainline. 2016-11-13 Eric Botcazou * gcc-interface/decl.c (annotate_value) : Deal specially with negative constants. -- Eric Botcazou Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 242334) +++ gcc-interface/decl.c (working copy) @@ -8022,6 +8022,14 @@ annotate_value (tree gnu_size) switch (TREE_CODE (gnu_size)) { case INTEGER_CST: + /* For negative values, build NEGATE_EXPR of the opposite. Such values + can appear for discriminants in expressions for variants. */ + if (tree_int_cst_sgn (gnu_size) < 0) + { + tree t = wide_int_to_tree (sizetype, wi::neg (gnu_size)); + return annotate_value (build1 (NEGATE_EXPR, sizetype, t)); + } + return TREE_OVERFLOW (gnu_size) ? No_Uint : UI_From_gnu (gnu_size); case COMPONENT_REF: