From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12146 invoked by alias); 15 Jan 2014 05:26:14 -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 12099 invoked by uid 48); 15 Jan 2014 05:26:09 -0000 From: "jvdelisle at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/59774] [Regression] Inconsistent rounding between -m32 and -m64 Date: Wed, 15 Jan 2014 05:26: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: jvdelisle at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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/msg01523.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59774 --- Comment #10 from Jerry DeLisle --- Very interesting and good sleuthing! The way this is suppose to work: For G formatting, we compute the equivalent F or E formatting, as defined in the standard, and pass this new format to output_float which then uses the regular existing formatting processes to do the work. This line: (on or about line 1105 in write_float.def newf.u.real.d = m == 0.0 ? d - 1 : -(mid - d - 1) ;\ is suppose to compute the new 'd' from mid and the given "d" and pass that into output_float using the newf fnode structure. In the failing case the new 'd' is being set to zero and being passed on. As far as your 'kludge'. I don't think of it that way, but we should see if there is a way to correctly compute the d_o value where you are using it in output_float. There should be a way. Since the standard defines all we do in terms of F and E formatting, I think we are mishandling something there in output_float. You are very close to the solution here. (of course I could be wrong). Someone on the list once said, if it fixes the bug, its probably good enough. The computer has no feelings about "correctness" of approach.