From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30358 invoked by alias); 12 Jan 2014 15:06:44 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 30325 invoked by uid 48); 12 Jan 2014 15:06:39 -0000 From: "dominiq at lps dot ens.fr" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/59774] [Regression] Inconsistent rounding between -m32 and -m64 Date: Sun, 12 Jan 2014 15:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libfortran X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dominiq at lps dot ens.fr X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jvdelisle at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-01/txt/msg01270.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59774 --- Comment #5 from Dominique d'Humieres --- For the tests in comment 1, I think PR323 strikes back again. I the same results for both -m32 and -m64 with the following patch --- ../_clean/libgfortran/io/write_float.def 2014-01-04 15:51:53.000000000 +0100 +++ libgfortran/io/write_float.def 2014-01-12 15:55:24.000000000 +0100 @@ -1043,10 +1043,11 @@ output_float_FMT_G_ ## x (st_parameter_d break;\ }\ \ - rexp_d = calculate_exp_ ## x (-d);\ - if ((m > 0.0 && ((m < 0.1 - 0.1 * r * rexp_d) || (rexp_d * (m + r) >= 1.0)))\ + rexp_d = calculate_exp_ ## x (d);\ + if ((m > 0.0 && ((10.0 * rexp_d * m < rexp_d - r ) || ((m + r) >= rexp_d)))\ || ((m == 0.0) && !(compile_options.allow_std\ - & (GFC_STD_F2003 | GFC_STD_F2008))))\ + & (GFC_STD_F2003 | GFC_STD_F2008)))\ + || d == 0)\ { \ newf.format = FMT_E;\ newf.u.real.w = w;\ @@ -1069,7 +1070,7 @@ output_float_FMT_G_ ## x (st_parameter_d volatile GFC_REAL_ ## x temp;\ mid = (low + high) / 2;\ \ - temp = (calculate_exp_ ## x (mid - 1) * (1 - r * rexp_d));\ + temp = (calculate_exp_ ## x (mid - 1) * (rexp_d - r) / rexp_d);\ \ if (m < temp)\ { \ I think in order to avoid overflows (10.0 * rexp_d * m < rexp_d - r ) and ((m + r) >= rexp_d) should be exchanged.