[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #20 from jvdelisle at gcc dot gnu dot org 2009-05-02 23:29 --- Unassigning, time constraints -- jvdelisle at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|jvdelisle at gcc dot gnu dot|unassigned at gcc dot gnu |org |dot org Status|ASSIGNED|NEW http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #15 from jvdelisle at gcc dot gnu dot org 2008-12-22 14:55 --- Subject: Bug 37472 Author: jvdelisle Date: Mon Dec 22 14:53:37 2008 New Revision: 142884 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142884 Log: 2008-12-22 Jerry DeLisle jvdeli...@gcc.gnu.org PR libfortran/37472 * io/write_float.def (output_float_FMT_G_): Modify calculation of temp to avoid sensitivity to round-off. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/write_float.def -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #16 from dominiq at lps dot ens dot fr 2008-12-22 16:29 --- From http://gcc.gnu.org/ml/fortran/2008-12/msg00284.html: With Steve Kargl's help, the following simple patch was found to eliminate this output problem on x86-64. I plan to commit under simple and makes sense to do rule. Is not the same problem lurking in if ((m 0.0 m 0.1 - 0.05 / exp_d) || (m = exp_d - 0.5 ) ||\ with 0.1 and 0.05? Also there is probably some room for optimization in this piece of code. For instance calculate_exp_* computes 10**d through an algorithm linear in d, while it could be computed in O(log2(d)) (see poweri in gcc/builtins.c). Also the following change: --- /opt/gcc/_gcc_clean/libgfortran/io/write_float.def 2008-12-21 22:31:05.0 +0100 +++ /opt/gcc/gcc-4.4-work/libgfortran/io/write_float.def2008-12-22 16:27:10.0 +0100 @@ -640,8 +640,8 @@ GFC_REAL_ ## x temp;\ mid = (low + high) / 2;\ \ - temp = 0.1 * calculate_exp_ ## x (mid) - 0.5\ -* calculate_exp_ ## x (mid - d - 1);\ + temp = calculate_exp_ ## x (mid) \ +* (1.0 - 0.5 / exp_d) / 10;\ \ if (m temp)\ { \ speeds up by ~2s the following test: character(80) s real*8 x, y integer i x=1.0 y=0.0 do i = 1, 1000 write(s,*) y y = y + x end do print *, s end (still twice slower with gfortran than ifort or g77). Note that temp = calculate_exp_ ## x (mid-1) * (1.0 - 0.5 / exp_d) is slightly slower. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #17 from sdirkse at gams dot com 2008-12-22 20:37 --- After all the updates committed for this bug, I thought I'd try the latest, including updating to ggmp-4.2.4 and mpfr-2.3.2. Here's the result for the GCC 4.3.2 release and the latest GCC. Note that the 32-bit stuff hasn't changed and now I get all-stars output for *both* outputs in 64-bit, not just one of the outputs. sigvm:/export/home/distrib/lang/f90$/usr/local2/bin/gfortran -v Using built-in specs. Target: i386-pc-solaris2.10 Configured with: ../configure CC=gcc --prefix=/usr/local2 --build=i386-pc-solaris2.10 --with-gnu-as --with-as=/usr/local/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local --enable-languages=c,c++,fortran --enable-shared Thread model: posix gcc version 4.3.2 (GCC) sigvm:/export/home/distrib/lang/f90$cat bug.f PROGRAM bug IMPLICIT NONE DOUBLE PRECISION r COMMON /91/ r DOUBLE PRECISION x x = 1001 write(6,*) 'x = ', x r = 1000 write(6,*) 'r = ', r END sigvm:/export/home/distrib/lang/f90$/usr/local2/bin/gfortran -o bug32 -m32 bug.f sigvm:/export/home/distrib/lang/f90$/usr/local2/bin/gfortran -o bug64 -m64 bug.f sigvm:/export/home/distrib/lang/f90$./bug32 x =1001.0 r = 1000.00 sigvm:/export/home/distrib/lang/f90$./bug64 x =1001.0 r = sigvm:/export/home/distrib/lang/f90$/usr/local3/bin/gfortran -v Using built-in specs. Target: i386-pc-solaris2.11 Configured with: ../configure CC=gcc --prefix=/usr/local3 --build=i386-pc-solaris2.11 --with-gnu-as --with-as=/usr/local/bin/as --without-gnu-ld --with-ld=/usr/ccs/bin/ld --with-gmp=/usr/local --with-mpfr=/usr/local --enable-languages=c,c++,fortran --enable-shared Thread model: posix gcc version 4.4.0 20081222 (experimental) (GCC) sigvm:/export/home/distrib/lang/f90$/usr/local3/bin/gfortran -o bug32 -m32 bug.f sigvm:/export/home/distrib/lang/f90$/usr/local3/bin/gfortran -o bug64 -m64 bug.f sigvm:/export/home/distrib/lang/f90$./bug32 x =1001.0 r = 1000.00 sigvm:/export/home/distrib/lang/f90$./bug64 x = r = sigvm:/export/home/distrib/lang/f90$ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #18 from kargl at gcc dot gnu dot org 2008-12-22 21:03 --- (In reply to comment #17) After all the updates committed for this bug, I thought I'd try the latest, including updating to ggmp-4.2.4 and mpfr-2.3.2. Here's the result for the GCC 4.3.2 release and the latest GCC. Note that the 32-bit stuff hasn't changed and now I get all-stars output for *both* outputs in 64-bit, not just one of the outputs. The audit trail shows that patch hasn't been back ported to 4.3.x branch. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #19 from jvdelisle at gcc dot gnu dot org 2008-12-22 21:27 --- Yes, so far I am only working with 4.4. Regardless, it appears that on this platform the width is being computed incorrectly. I count 20 stars in the field width. The required field width for the output on x86-64 is 28. So there is an off by one 8-byte word going on here. I suspect that the decimal point shifting problem which is now fixed on 4.4 is a separate problem. I will keep at it. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #14 from dominiq at lps dot ens dot fr 2008-12-21 13:34 --- This little patch eliminates the misalignment of output characters with -m32 and gets rid of a many many valgrind errors. @@ -628,7 +637,7 @@ output_float_FMT_G_ ## x (st_parameter_d \ while (low = high)\ { \ - GFC_REAL_ ## x temp;\ + float temp;\ mid = (low + high) / 2;\ \ temp = 0.1 * calculate_exp_ ## x (mid) - 0.5\ Do you understand why? Such a change is the opposite of what I understand of the GFC_REAL_* machinery, although I have no knowledge about mixed calculations in C. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #13 from jvdelisle at gcc dot gnu dot org 2008-12-21 05:28 --- This little patch eliminates the misalignment of output characters with -m32 and gets rid of a many many valgrind errors. @@ -628,7 +637,7 @@ output_float_FMT_G_ ## x (st_parameter_d \ while (low = high)\ { \ - GFC_REAL_ ## x temp;\ + float temp;\ mid = (low + high) / 2;\ \ temp = 0.1 * calculate_exp_ ## x (mid) - 0.5\ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #12 from jvdelisle at gcc dot gnu dot org 2008-12-13 15:29 --- I am trying not to lose sight of the original problem in comment zero. However, the decimal output alignment problem fixed in comment 9 still exists with -m32 on x86-64 and I can see it with 32 bit windows as well. There a a similar shifting in pr38504. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #9 from jvdelisle at gcc dot gnu dot org 2008-11-21 04:31 --- Subject: Bug 37472 Author: jvdelisle Date: Fri Nov 21 04:29:54 2008 New Revision: 142079 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142079 Log: 2008-11-20 Jerry DeLisle [EMAIL PROTECTED] PR libfortran/37472 * io/write_float.def (output_float_FMT_G_): Adjust conversion of G format specification to F format. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/write_float.def -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #10 from jvdelisle at gcc dot gnu dot org 2008-11-21 04:36 --- Subject: Bug 37472 Author: jvdelisle Date: Fri Nov 21 04:35:17 2008 New Revision: 142080 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142080 Log: 2008-11-20 Jerry DeLisle [EMAIL PROTECTED] PR libfortran/37472 * gfortran.dg/namelist_print_1.f: Update test. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/namelist_print_1.f -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #11 from jvdelisle at gcc dot gnu dot org 2008-11-21 04:38 --- The above patch only fixes a portion of this bug. The remaining is I have not been able to see the problem yet. I have access to a solaris machine now, but have not been able to build gfortran yet. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #8 from jvdelisle at gcc dot gnu dot org 2008-11-17 05:03 --- The shifting of the decimal point between 1000. and 1001. is an artefact of how we compute the format specifiers in the OUTPUT_FLOAT macro in write_float.def. I am working on a solution to that part of this. The issue with the doubles in common I suspect is some sort of alignment issue, but I do not see it here. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #6 from jvdelisle at gcc dot gnu dot org 2008-10-11 15:54 --- I will be looking at this. -- jvdelisle at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |jvdelisle at gcc dot gnu dot |dot org |org Status|UNCONFIRMED |ASSIGNED Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2008-10-11 15:54:29 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #7 from jvdelisle at gcc dot gnu dot org 2008-10-11 15:59 --- Response to comment #4. We added 1 to the default width in 4.3. The rest has to do with the rounding logic. I dropped this bug in the crack, so assigned to myself so i will not forget it. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #2 from burnus at gcc dot gnu dot org 2008-09-11 06:01 --- I cannot reproduce the problem with gfortran 4.1, 4.2, 4.3 or 4.4 on x86-64-linux with either -m32 or -m64, which makes debugging not easier. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #3 from dominiq at lps dot ens dot fr 2008-09-11 11:37 --- I cannot reproduce it on ppc/intel Darwin9, however the following code: PROGRAM bug IMPLICIT NONE DOUBLE PRECISION r COMMON /91/ r DOUBLE PRECISION x x = 1000 write(6,*) 'x = ', x r = 1000 write(6,*) 'r = ', r x = 1001 write(6,*) 'x = ', x r = 1001 write(6,*) 'r = ', r END gives x =1000.000 r =1000.000 x =1001.000 r =1001.000 with gfortran 4.2.3 and x = 1000.00 r = 1000.00 x =1001.0 r =1001.0 with 4.3.2 and 4.4.0 (trunk). Is this expected? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #4 from burnus at gcc dot gnu dot org 2008-09-11 14:27 --- Jerry, do you know why gfortran 4.3/4.4 prints one trailing zero more for 1000 than for other numbers? 4.2 used the same number of trailing digits. 1000.0 1001. for print *, 1000.0 print *, 1001.0 end If one uses 0.2 more, one gets the expected 1000.2000 1001.2000 And for 100.0 it is off by one again. (Maybe you have also an idea about the problem in comment 0.) -- burnus at gcc dot gnu dot org changed: What|Removed |Added CC||jvdelisle at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #5 from jvdelisle at gcc dot gnu dot org 2008-09-12 03:52 --- I will have to explore a bit. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472
[Bug fortran/37472] bad output on default-format write of double in common block with -m64 flag i
--- Comment #1 from sdirkse at gams dot com 2008-09-11 00:56 --- Created an attachment (id=16289) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=16289action=view) test case -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37472