public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Arnaud Charlet <charlet@adacore.com>, Robert Dewar <dewar@adacore.com>
Subject: Re: [Ada] Ensure consistency of fpt exponentiation results
Date: Tue, 26 May 2015 21:31:00 -0000	[thread overview]
Message-ID: <3550734.dbQtBZf86h@polaris> (raw)
In-Reply-To: <20150526103520.GA27917@adacore.com>

[-- Attachment #1: Type: text/plain, Size: 754 bytes --]

> This change ensures on all targets that A**B = A**C when B is a small
> static constant in the range 0 .. 4 and C is a variable with the same
> value. Previously for Float and Long_Float on some targets, this was
> not the case. The results given were both within the error bounds that
> are allowed by the Ada standard, but it is desirable not to have this
> discrepancy.

This uncovered a bug in gigi, responsible for 

                === acats tests ===
FAIL:  c44003d


Fixed thusly, tested on x86_64-suse-linux, applied on the mainline.


2015-05-26  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (Attribute_to_gnu) <Attr_Machine>: Do not apply
	extra-precision trick to literals.  Build SAVE_EXPR manually.


-- 
Eric Botcazou

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 896 bytes --]

Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 223709)
+++ gcc-interface/trans.c	(working copy)
@@ -2428,7 +2428,8 @@ Attribute_to_gnu (Node_Id gnat_node, tre
       gnu_result_type = get_unpadded_type (Etype (gnat_node));
       gnu_result = convert (gnu_result_type, gnu_expr);
 
-      if (fp_arith_may_widen
+      if (TREE_CODE (gnu_result) != REAL_CST
+	  && fp_arith_may_widen
 	  && TYPE_PRECISION (gnu_result_type)
 	     < TYPE_PRECISION (longest_float_type_node))
 	{
@@ -2441,7 +2442,7 @@ Attribute_to_gnu (Node_Id gnat_node, tre
 	  finish_record_type (rec_type, field, 0, false);
 
 	  rec_val = build_constructor_single (rec_type, field, gnu_result);
-	  rec_val = save_expr (rec_val);
+	  rec_val = build1 (SAVE_EXPR, rec_type, rec_val);
 
 	  asm_expr
 	    = build5 (ASM_EXPR, void_type_node,

      reply	other threads:[~2015-05-26 20:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-26 11:03 Arnaud Charlet
2015-05-26 21:31 ` Eric Botcazou [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3550734.dbQtBZf86h@polaris \
    --to=ebotcazou@adacore.com \
    --cc=charlet@adacore.com \
    --cc=dewar@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).