From patchwork Tue Mar 6 12:21:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 882043 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-474326-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="FeBnpvLU"; 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 3zwbW62Cwrz9shV for ; Tue, 6 Mar 2018 23:22:09 +1100 (AEDT) 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=Mcxu1Mfx2wT1h1FL KVE8Lon5pop6pHJpDEevEy57EF5N/N9KH+N1RpiiTjZ275fRtoXTBIgFI7l9lWsE KCNe0z8JQcW92OTf6Lei+ju3qdUl8ulk0Npqi9M2caNhlVPNnldXg+dn8gnDZBug oTeWi4SG/c+NltJgu0yp4N5KfKA= 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=GPIYQwDiCCN89jJHpc9+zz 2edbI=; b=FeBnpvLU2V+DHt0p0mruddBtUeDPvlufq3H3HQKajSzwv37kJrNCQs bbdWf3esxYwkqHNciRx5PcKYU43VYU++PzMstXwnnf0qapVv3S7Rkr0flp/4npZl GWT8ERDBTf/CEZFYa57720TmSGT1VIqcOSZS3nCANMXRUUzATWgHo= Received: (qmail 106796 invoked by alias); 6 Mar 2018 12:22:02 -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 106782 invoked by uid 89); 6 Mar 2018 12:22:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= 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; Tue, 06 Mar 2018 12:22:01 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 4586C8139C for ; Tue, 6 Mar 2018 13:21:59 +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 Q4j5eTcWvWVE for ; Tue, 6 Mar 2018 13:21:59 +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 280EA81398 for ; Tue, 6 Mar 2018 13:21:59 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix incomplete narrowing FP conversion for Machine_Overflows Date: Tue, 06 Mar 2018 13:21:57 +0100 Message-ID: <3080506.aIK83GraIe@polaris> MIME-Version: 1.0 On platforms where System'Machine_Overflows is true, the compiler generates a check only for the lower bound of the output type in a narrowing floating- point conversion, which means that e.g. the last chance handler will not be invoked if the value overflows the upper bound of the output type. Applied on all active branches. 2018-03-06 Eric Botcazou * gcc-interface/trans.c (convert_with_check): Fix typo in the condition guarding the overflow check emitted for the upper bound of a floating- point conversion. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 258231) +++ gcc-interface/trans.c (working copy) @@ -9381,7 +9381,7 @@ convert_with_check (Entity_Id gnat_type, ? tree_int_cst_lt (gnu_out_ub, gnu_in_ub) : (FLOAT_TYPE_P (gnu_base_type) ? real_less (&TREE_REAL_CST (gnu_out_ub), - &TREE_REAL_CST (gnu_in_lb)) + &TREE_REAL_CST (gnu_in_ub)) : 1)) gnu_cond = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, gnu_cond,