From patchwork Sun Jan 12 14:30:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 309582 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 191642C0081 for ; Mon, 13 Jan 2014 01:31:11 +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:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=VIZKS0MAjwvce/Sa al13ayp/70zQk0wQwJoVgNISyK7scPMj/wgcaZ7gERqLqfYuKsAwaWeyy3FN7FfS cfM5uZ7GEnfa5kiGmBMVgMyILaYfuWBEQGLqVDAfqIlPwpkf0ITXf74v4xFS1fsh muMPop7EfCRrGSMMndbrVw0uJVA= 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=RMCBsml/gWv9RWgQDuvYXc DNuj8=; b=prxYYm8vWWf8kE9QV8WIstr/FUSQOsl81aoyXZOs14XbREG+eK9Whv ZOwEwdSsq1Wsy5ooyCcnpod498v23PcVMWZuRHZqqoJY2ncXQH7E1Pie1Us9RlW7 18adVWL1OlhyaRTGhzOi3L+BwTDYuoFl++pdq6VnhtPSB57KhpIMg= Received: (qmail 16745 invoked by alias); 12 Jan 2014 14:31:04 -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 16724 invoked by uid 89); 12 Jan 2014 14:31:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Sun, 12 Jan 2014 14:31:01 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 4EB6526CC175 for ; Sun, 12 Jan 2014 15:30:58 +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 X2Q68v7Jjd6Z for ; Sun, 12 Jan 2014 15:30:58 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 26AA226CC174 for ; Sun, 12 Jan 2014 15:30:58 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix PR ada/59772 Date: Sun, 12 Jan 2014 15:30:55 +0100 Message-ID: <13900245.SGbW2BrlYD@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.29-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 This is a regression present on all active branches for 8-bit/16-bit targets and introduced by the rewrite of build_int_cst which now truncates its output. Tested on x86_64-suse-linux, applied on all active branches. 2014-01-12 Eric Botcazou PR ada/59772 * gcc-interface/cuintp.c (build_cst_from_int): Use 32-bit integer type as intermediate type. (UI_To_gnu): Likewise. Index: gcc-interface/cuintp.c =================================================================== --- gcc-interface/cuintp.c (revision 206563) +++ gcc-interface/cuintp.c (working copy) @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2013, Free Software Foundation, Inc. * + * Copyright (C) 1992-2014, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -55,7 +55,7 @@ static tree build_cst_from_int (tree type, HOST_WIDE_INT low) { if (SCALAR_FLOAT_TYPE_P (type)) - return convert (type, build_int_cst (NULL_TREE, low)); + return convert (type, build_int_cst (gnat_type_for_size (32, 0), low)); else return build_int_cst_type (type, low); } @@ -89,19 +89,12 @@ UI_To_gnu (Uint Input, tree type) gcc_assert (Length > 0); /* The computations we perform below always require a type at least as - large as an integer not to overflow. REAL types are always fine, but + large as an integer not to overflow. FP types are always fine, but INTEGER or ENUMERAL types we are handed may be too short. We use a base integer type node for the computations in this case and will - convert the final result back to the incoming type later on. - The base integer precision must be superior than 16. */ - - if (TREE_CODE (comp_type) != REAL_TYPE - && TYPE_PRECISION (comp_type) - < TYPE_PRECISION (long_integer_type_node)) - { - comp_type = long_integer_type_node; - gcc_assert (TYPE_PRECISION (comp_type) > 16); - } + convert the final result back to the incoming type later on. */ + if (!SCALAR_FLOAT_TYPE_P (comp_type) && TYPE_PRECISION (comp_type) < 32) + comp_type = gnat_type_for_size (32, 0); gnu_base = build_cst_from_int (comp_type, Base);