* [Patch] PR 70235 - [4.9/5/6 Regression] Incorrect output with PF format
@ 2016-03-30 20:19 Dominique d'Humières
2016-03-30 20:39 ` Jerry DeLisle
0 siblings, 1 reply; 3+ messages in thread
From: Dominique d'Humières @ 2016-03-30 20:19 UTC (permalink / raw)
To: fortran; +Cc: Jerry DeLisle, gcc-patches
Is the following patch OK for trunk and the gcc-4.9 and gcc-5 branches after some delay (bootstrapped and regtested on x86_64-apple-darwin15)?
TIA
Dominique
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog (revision 234597)
+++ gcc/testsuite/ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2016-03-30 Dominique d'Humieres <dominiq@lps.ens.fr>
+ Jerry DeLisle <jvdelisle@gcc.gnu.org>
+
+ gfortran.dg/fmt_pf.f90: New test.
+
2016-03-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
Forward-port from 5 branch
Index: libgfortran/ChangeLog
===================================================================
--- libgfortran/ChangeLog (revision 234597)
+++ libgfortran/ChangeLog (working copy)
@@ -1,3 +1,10 @@
+2016-03-30 Jerry DeLisle <jvdelisle@gcc.gnu.org>
+ Dominique d'Humieres <dominiq@lps.ens.fr>
+
+ PR libgfortran/70235
+ * io/write_float.def: Fix PF format for negative values of the scale
+ factor.
+
2016-03-28 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* caf/libcaf.h: caf_stop_numeric and caf_stop_str prototype.
Index: libgfortran/io/write_float.def
===================================================================
--- libgfortran/io/write_float.def (revision 234597)
+++ libgfortran/io/write_float.def (working copy)
@@ -184,9 +184,6 @@
memmove (digits + nbefore, digits + nbefore + 1, p);
digits[nbefore + p] = '.';
nbefore += p;
- nafter = d - p;
- if (nafter < 0)
- nafter = 0;
nafter = d;
nzero = 0;
}
@@ -204,12 +201,27 @@
{
nzero = -(nbefore + p);
memmove (digits + 1, digits, nbefore);
- digits++;
- nafter = d + nbefore;
+ nafter = d - nzero;
+ if (nafter == 0 && d > 0)
+ {
+ /* This is needed to get the correct rounding. */
+ memmove (digits + 1, digits, ndigits - 1);
+ digits[1] = '0';
+ nafter = 1;
+ nzero = d - 1;
+ }
+ else if (nafter < 0)
+ {
+ /* Reset digits to 0 in order to get correct rounding
+ towards infinity. */
+ for (i = 0; i < ndigits; i++)
+ digits[i] = '0';
+ digits[ndigits - 1] = '1';
+ nafter = d;
+ nzero = 0;
+ }
nbefore = 0;
}
- if (nzero > d)
- nzero = d;
}
}
else
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] PR 70235 - [4.9/5/6 Regression] Incorrect output with PF format
2016-03-30 20:19 [Patch] PR 70235 - [4.9/5/6 Regression] Incorrect output with PF format Dominique d'Humières
@ 2016-03-30 20:39 ` Jerry DeLisle
2016-03-30 21:40 ` Dominique d'Humières
0 siblings, 1 reply; 3+ messages in thread
From: Jerry DeLisle @ 2016-03-30 20:39 UTC (permalink / raw)
To: Dominique d'Humières, fortran; +Cc: gcc-patches
On 03/30/2016 01:18 PM, Dominique d'Humières wrote:
> Is the following patch OK for trunk and the gcc-4.9 and gcc-5 branches after some delay (bootstrapped and regtested on x86_64-apple-darwin15)?
Yes, OK, thanks for help!!
Jerry
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] PR 70235 - [4.9/5/6 Regression] Incorrect output with PF format
2016-03-30 20:39 ` Jerry DeLisle
@ 2016-03-30 21:40 ` Dominique d'Humières
0 siblings, 0 replies; 3+ messages in thread
From: Dominique d'Humières @ 2016-03-30 21:40 UTC (permalink / raw)
To: jvdelisle; +Cc: fortran, gcc-patches
Thanks for the quick review. Committed on trunk as revision r234600. I’ll wait a week for gcc-5 and gcc-4.9.
Dominique
> Le 30 mars 2016 à 22:38, Jerry DeLisle <jvdelisle@charter.net> a écrit :
>
> On 03/30/2016 01:18 PM, Dominique d'Humières wrote:
>> Is the following patch OK for trunk and the gcc-4.9 and gcc-5 branches after some delay (bootstrapped and regtested on x86_64-apple-darwin15)?
>
> Yes, OK, thanks for help!!
>
> Jerry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-30 21:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-30 20:19 [Patch] PR 70235 - [4.9/5/6 Regression] Incorrect output with PF format Dominique d'Humières
2016-03-30 20:39 ` Jerry DeLisle
2016-03-30 21:40 ` Dominique d'Humières
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).