[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #36 from janis at gcc dot gnu dot org 2008-12-19 17:50 --- I'll revert the patch that changes the XFAIL. I noticed yesterday that the test was failing on powerpc64-linux on a distribution that I hadn't tested on before, although the new XFAIL had worked on the other distributions I tried. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #37 from janis at gcc dot gnu dot org 2008-12-19 18:14 --- Subject: Bug 24685 Author: janis Date: Fri Dec 19 18:12:40 2008 New Revision: 142840 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142840 Log: Revert: 2008-12-12 Janis Johnson janis...@us.ibm.com PR libgfortran/24685 * gfortran.dg/default_format_denormal_2.f90: Change XFAIL to check for size of long double. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #38 from janis at gcc dot gnu dot org 2008-12-19 18:22 --- Subject: Bug 24685 Author: janis Date: Fri Dec 19 18:20:41 2008 New Revision: 142841 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142841 Log: Revert: 2008-12-12 Janis Johnson janis...@us.ibm.com PR libgfortran/24685 * gfortran.dg/default_format_denormal_2.f90: Change XFAIL to check for size of long double. Modified: branches/gcc-4_3-branch/gcc/testsuite/ChangeLog branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #35 from howarth at nitro dot med dot uc dot edu 2008-12-19 01:38 --- Revision 142724 causes... FAIL: gfortran.dg/default_format_denormal_2.f90 -O0 execution test FAIL: gfortran.dg/default_format_denormal_2.f90 -O1 execution test FAIL: gfortran.dg/default_format_denormal_2.f90 -O2 execution test FAIL: gfortran.dg/default_format_denormal_2.f90 -O3 -fomit-frame-pointer execution test FAIL: gfortran.dg/default_format_denormal_2.f90 -O3 -fomit-frame-pointer -funroll-loops execution test FAIL: gfortran.dg/default_format_denormal_2.f90 -O3 -fomit-frame-pointer -funroll-all-loops -finline-functions execution test FAIL: gfortran.dg/default_format_denormal_2.f90 -O3 -g execution test FAIL: gfortran.dg/default_format_denormal_2.f90 -Os execution test on powerpc-apple-darwin8.5.0. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #33 from janis at gcc dot gnu dot org 2008-12-12 22:18 --- Subject: Bug 24685 Author: janis Date: Fri Dec 12 22:17:31 2008 New Revision: 142724 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142724 Log: PR libgfortran/24685 * gfortran.dg/default_format_denormal_2.f90: Change XFAIL to check for size of long double. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #34 from janis at gcc dot gnu dot org 2008-12-12 22:22 --- Subject: Bug 24685 Author: janis Date: Fri Dec 12 22:21:14 2008 New Revision: 142725 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=142725 Log: PR libgfortran/24685 * gfortran.dg/default_format_denormal_2.f90: Change XFAIL to check for size of long double. Modified: branches/gcc-4_3-branch/gcc/testsuite/ChangeLog branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #32 from uros at gcc dot gnu dot org 2008-02-28 07:09 --- Subject: Bug 24685 Author: uros Date: Thu Feb 28 07:08:51 2008 New Revision: 132737 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=132737 Log: PR target/25477 * gcc/config/darwin-protos.h: Add darwin_patch_builtins prototype. * gcc/config/darwin-ppc-ldouble-patch.def: New file. * gcc/config/rs6000/darwin.h (SUBTARGET_INIT_BUILTINS): New macro. * gcc/config/rs6000/rs6000.c (rs6000_init_builtins): Call SUBTARGET_INIT_BUILTINS if defined. * gcc/config/darwin.c (darwin_patch_builtin, darwin_patch_builtins): New functions. fortran/ChangeLog: PR target/25477 * trans-expr.c (gfc_conv_power_op): Use BUILT_IN_CPOW{F,,L}. * f95-lang.c (gfc_init_builtin_functions): Define BUILT_IN_CPOW{F,,L}. * trans.h (gfor_fndecl_math_cpow, gfor_fndecl_math_cpowf, gfor_fndecl_math_cpowl10, gfor_fndecl_math_cpowl16): Remove. * trans-decl.c: Likewise. testsuite/ChangeLog: PR libfortran/24685 * gfortran.dg/large_real_kind_form_io_2.f90: XFAIL on powerpc*-apple-darwin*. * gfortran.dg/large_real_kind_2.F90: Split testing of ERF and ERFC into gfortran.dg/large_real_kind_3.F90. * gfortran.dg/large_real_kind_3.F90: New test. Added: branches/gcc-4_3-branch/gcc/config/darwin-ppc-ldouble-patch.def branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/large_real_kind_3.F90 Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/darwin-protos.h branches/gcc-4_3-branch/gcc/config/darwin.c branches/gcc-4_3-branch/gcc/config/rs6000/darwin.h branches/gcc-4_3-branch/gcc/config/rs6000/rs6000.c branches/gcc-4_3-branch/gcc/fortran/ChangeLog branches/gcc-4_3-branch/gcc/fortran/f95-lang.c branches/gcc-4_3-branch/gcc/fortran/trans-decl.c branches/gcc-4_3-branch/gcc/fortran/trans-expr.c branches/gcc-4_3-branch/gcc/fortran/trans.h branches/gcc-4_3-branch/gcc/testsuite/ChangeLog branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/large_real_kind_2.F90 branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #30 from fxcoudert at gcc dot gnu dot org 2008-02-23 20:10 --- On powerpc-apple-darwin9.2, gfortran.dg/large_real_kind_form_io_2.f90 fails for that reason: $ cat a.f90 real(kind=16) :: a,b character(len=180) :: tmp b = 8.98846567431157953864652595394501287669662887245e307_16 write (tmp, *) b read (tmp, *) a write(*,(G70.55E4)) b write(*,(G70.55E4)) a write(*,(G70.55E4)) a-b if (a /= b) print *, # end $ ./bin/gfortran a.f90 ./a.out 0.898846567431157953864652595394512366810E+0308 0.898846567431157953864652595394512366810E+0308 0.110791393256022264271830208461724263440E+0277 # But, as the following C testcase shows, that's not a gfortran problem, but rather a libc issue on darwin: $ cat a.c #include stdio.h #include string.h int main(void) { long double x, y = 8.98846567431157953864652595394501287669662887245e307L; char buf[79]; memset (buf, ' ', sizeof(buf)); sprintf (buf, %60.70Lg, y); puts (buf); sscanf (buf, %Lg, x); memset (buf, ' ', sizeof(buf)); sprintf (buf, %60.70Lg, x); puts (buf); printf (%60.70Lg\n, x-y); return 0; } $ gcc a.c ./a.out 8.988465674311579538646525953945123668089884894711532863671504057886634e+307 8.988465674311579538646525953945123668089884894711532863671504057886634e+307 1.107913932560222642718302084617242634394213707491304322373697056856707e+276 I have reported that issue to Apple as radar #5761818, we'll see if it is fixed, but I doubt it (no new PowerPC sold by Apple, and generally little interest in long double). I have thus XFAILed gfortran.dg/large_real_kind_form_io_2.f90 on powerpc*-apple-darwin*. As comment #27 says, this doesn't fail on sparc-solaris, I'm closing this as INVALID. Please reopen if you have a testcase on another target where the issue is not due to a faulty libc. -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #31 from fxcoudert at gcc dot gnu dot org 2008-02-23 20:11 --- Subject: Bug 24685 Author: fxcoudert Date: Sat Feb 23 20:10:29 2008 New Revision: 132577 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=132577 Log: PR libfortran/24685 * gfortran.dg/large_real_kind_form_io_2.f90: XFAIL on powerpc*-apple-darwin*. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #29 from dominiq at lps dot ens dot fr 2008-01-25 15:40 --- see also pr32841. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #28 from dominiq at lps dot ens dot fr 2008-01-24 14:01 --- Some remarks from powerpc-apple-darwin9: (1) the title is misleading: formatted inputs are not broken, formatted outputs are. (2) they seem broken for constants nearest from bellow any power of two, as shown by the following code: [karma] bug/real16% cat real_16_red.f90 real(16) :: x x = 1.0_16 print *, nearest(x,-x), nearest(x,x) print *, nearest(1.0_16,-1.0_16), nearest(1.0_16,1.0_16) end [karma] bug/real16% gfc -fno-range-check real_16_red.f90 [karma] bug/real16% a.out 0.9998767 1.000247 1.000 1.0002465 where nearest(1.0_16,-1.0_16) is ouput as 1.0...0 and not as 0.9...98767. (3) As huge(1.0_16) is treated as a constant, I had to pay hide-and-seek with gfortran in the following code: [karma] bug/real16% cat huge_16.f90 character(80) :: tmp real(16) :: x, y x = 2.0_16**1022 print *, 2.0_16*x, 2.0_16*x-huge(x) ! 2.0_16**1023 is larger than huge(x) but not printed as +Inf y = nearest(4.0_16*x,-x) print *, 4.0_16*x, nearest(2.0_16*x,x), nearest(y,-x) x = nearest(2.0_16*x,-x) ! hide huge in a variable print *, x, x-huge(x) write(tmp,*) x read(tmp,*) y print *, x, y, x-y! the printed value of y is not the same the one for x x = nearest(x,1.0_16) print *, x, nearest(x,1.0_16) print *, 8.98846567431157953864652595394512367E+0307_16 end [karma] bug/real16% gfc -fno-range-check huge_16.f90 [karma] bug/real16% a.out 8.98846567431157953864652595394512367E+0307 1.10791393256022264271830208461724263E+0276 +Infinity 8.98846567431157953864652595394534525E+0307 +Infinity 8.98846567431157953864652595394501288E+0307 0.00 8.98846567431157953864652595394501288E+0307 8.98846567431157953864652595394512367E+0307 0.00 8.98846567431157953864652595394512367E+0307 8.98846567431157953864652595394534525E+0307 +Infinity where x is an hidden huge(x), correctly printed as 8.98846567431157953864652595394501288E+0307, correctly read as y (x-y==0.0), while y is printed as 8.98846567431157953864652595394534525E+0307==+Inf. Note also several value above huge(x) not printed as +Inf. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #26 from burnus at gcc dot gnu dot org 2008-01-17 10:49 --- Add gfortran.dg/default_format_2.f90 to the summary as that test case points here. It seems to fail also for s390-ibm-linux-gnu (for test (1.0_kl, 0)) and for sparc-unknown-linux-gnu (these are not yet XFAILED). XFAILed are currently: powerpc*-apple-darwin* *-*-freebsd* powerpc*-*-linux* However, the target field of this PR shows: sparc-solaris, powerpc-darwin. Is sparc-solaris also affected or not? -- burnus at gcc dot gnu dot org changed: What|Removed |Added Summary|real(16) formatted input is |real(16) formatted input is |broken for huge values |broken for huge values ||(gfortran.dg/default_format_ ||2.f90) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values (gfortran.dg/default_format_2.f90)
--- Comment #27 from ebotcazou at gcc dot gnu dot org 2008-01-17 13:11 --- Add gfortran.dg/default_format_2.f90 to the summary as that test case points here. But this is confusing, as demonstrated by... It seems to fail also for s390-ibm-linux-gnu (for test (1.0_kl, 0)) and for sparc-unknown-linux-gnu (these are not yet XFAILED). XFAILed are currently: powerpc*-apple-darwin* *-*-freebsd* powerpc*-*-linux* However, the target field of this PR shows: sparc-solaris, powerpc-darwin. Is sparc-solaris also affected or not? ...this. No, gfortran.dg/default_format_2.f90 doesn't fail on SPARC/Solaris. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #25 from jvdelisle at gcc dot gnu dot org 2007-11-12 05:44 --- This is now: [Bug libc/5268] huge and denornal reads and writes for long doubles http://sourceware.org/bugzilla/show_bug.cgi?id=5268 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #24 from jvdelisle at gcc dot gnu dot org 2007-11-03 16:48 --- Subject: Bug 24685 Author: jvdelisle Date: Sat Nov 3 16:47:37 2007 New Revision: 129871 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=129871 Log: 2007-11-03 Jerry DeLisle [EMAIL PROTECTED] PR libfortran/24685 * gfortran.dg/default_format_2.f90: XFAIL powerpc*-*-linux* * gfortran.dg/default_format_denormal_2.f90: XFAIL powerpc*-*-linux* * gfortran.dg/large_real_kind_form_io_2.f90: XFAIL powerpc*-*-linux* Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/default_format_2.f90 trunk/gcc/testsuite/gfortran.dg/default_format_denormal_2.f90 trunk/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #23 from dominiq at lps dot ens dot fr 2007-05-26 17:51 --- Is this still broken or can we close? As far as I can tell it is still broken (http://gcc.gnu.org/ml/gcc/2007-05/msg00628.html). I would like to fix this if possible. Me too!-) If Jack Howarth send me a patch for 4.2 I can test it (allow for 15 hours, pbook G4 12) and can also try to test it on 4.3 (unfortunately I am presently blocked by a failure with libjava, if it is not fixede soon I'll disable it). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #22 from jvdelisle at gcc dot gnu dot org 2007-05-25 19:50 --- Is this still broken or can we close? I would like to fix this if possible. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #19 from fxcoudert at gcc dot gnu dot org 2006-05-24 18:58 --- (In reply to comment #18) it is still broken on powerpc{,64} Hi Jakub, I'm not sure exactly what is still broken. On powerpc-apple-darwin7.9.0, with mainline gfortran 20060512: $ cat foo.f90 ! { dg-do run } ! { dg-require-effective-target fortran_large_real } program huge_real10_formatted ! This should be kind=10 on systems that support it integer, parameter :: k = selected_real_kind (precision (0.0_8) + 1) real(kind=k) :: a,b(2), c character(len=180) :: tmp ! Test real(k) scalar and array formatted IO with big value b(:) = huge (1.0_k)/2 print *, 'real(10) big value: ', b(1) write (tmp, *) b read (tmp, *) a, c print *, 'same value read again: ', a print *, 'difference: ', a-b(1) ! Test with really big value b(:) = huge (1.0_k) print *, 'huge value: ', b(1) write (tmp, *) b read (tmp, *) a, c ! This is line 19 print *, We don't get this far! if (a /= b(1)) call abort () if (c /= b(2)) call abort () end program huge_real10_formatted $ gfortran foo.f90 ./a.out real(10) big value: 4.4942328371557897693232629769725618E+0307 same value read again: 4.4942328371557897693232629769725618E+0307 difference:0.0 huge value: 8.9884656743115795386465259539451237E+0307 We don't get this far! $ gfortran foo.f90 -mlong-double-128 ./a.out real(10) big value: 4.4942328371557897693232629769725618E+0307 same value read again: 4.4942328371557897693232629769725618E+0307 difference:0.0 huge value: 8.9884656743115795386465259539451237E+0307 We don't get this far! $ cat real16.f90 character(len=100) :: a real(kind=16) :: x, y, z x = huge(x) write(a,*) x read(a,*) y if (x /= y) print *, x, y, x-y end $ gfortran real16.f90 ./a.out $ gfortran real16.f90 -mlong-double-128 ./a.out All this looks like it's working fine... -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added CC||jakub at gcc dot gnu dot org AssignedTo|fxcoudert 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=24685
Re: [Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #19 from fxcoudert at gcc dot gnu dot org 2006-05-24 18:58 --- (In reply to comment #18) it is still broken on powerpc{,64} Hi Jakub, I'm not sure exactly what is still broken. On powerpc-apple-darwin7.9.0, with mainline gfortran 20060512: Darwin is broken a different way and it is a mess that I was trying to fix but it is still broken because I don't care that much anymore. -- Pinski
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #20 from pinskia at physics dot uc dot edu 2006-05-24 19:01 --- Subject: Re: real(16) formatted input is broken for huge values --- Comment #19 from fxcoudert at gcc dot gnu dot org 2006-05-24 18:58 --- (In reply to comment #18) it is still broken on powerpc{,64} Hi Jakub, I'm not sure exactly what is still broken. On powerpc-apple-darwin7.9.0, with mainline gfortran 20060512: Darwin is broken a different way and it is a mess that I was trying to fix but it is still broken because I don't care that much anymore. -- Pinski -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #21 from fxcoudert at gcc dot gnu dot org 2006-05-24 20:34 --- (In reply to comment #20) Darwin is broken a different way and it is a mess that I was trying to fix but it is still broken because I don't care that much anymore. Could you give a Fortran testcase that is not behaving as expected? -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added URL|http://gcc.gnu.org/ml/gcc- | |patches/2006- | |04/msg00264.html| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #17 from jakub at gcc dot gnu dot org 2006-04-21 17:04 --- Subject: Bug 24685 Author: jakub Date: Fri Apr 21 17:04:04 2006 New Revision: 113137 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=113137 Log: PR libgfortran/24685 * io/write.c (MIN_FIELD_WIDTH, STR, STR1): Define. (output_float): Increase buffer sizes for IEEE quad and IBM extended long double. (write_real): Output REAL(16) as 1PG43.34E4 rather than 1PG40.31E4. Modified: branches/gcc-4_1-branch/libgfortran/ChangeLog branches/gcc-4_1-branch/libgfortran/io/write.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #18 from jakub at gcc dot gnu dot org 2006-04-21 17:22 --- While this should now be fixed on s390{,x} (and I believe also sparc*) with -mlong-double-128, it is still broken on powerpc{,64}. What happens there is that gfortran returns a non-canonical number for huge (0.0_16) (by non-canonical I mean that the difference between upper and lower double's exponent is more than 53, in this case 106 or so, particularly upper double is 8.9884656743115795e+307 and lower double -1.1079139325602226e+276). libc only cares about 106 fraction bits, so when printed into buffer, it is already printed the same as 8.9884656743115795e+307 + 0.0 alone (i.e. 8.9884656743115795386465259539451237e+307) and when read back it is read as 8.9884656743115795e+307 + 0.0. I wonder if gfortran should either always or at least for the couple of special numbers for the real(16) and complex(16) kinds choose numbers that are canonical in this sense (and can thus be written and read back the same). E.g. when C parses IBM extended long double constants, they seem to be always canonical (supposedly because it always rounds to 106 fraction bits). -- jakub at gcc dot gnu dot org changed: What|Removed |Added CC||amodra at gcc dot gnu dot ||org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #16 from jakub at gcc dot gnu dot org 2006-04-10 12:02 --- Subject: Bug 24685 Author: jakub Date: Mon Apr 10 12:02:55 2006 New Revision: 112819 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=112819 Log: PR libgfortran/24685 * io/write.c (MIN_FIELD_WIDTH, STR, STR1): Define. (output_float): Increase buffer sizes for IEEE quad and IBM extended long double. (write_real): Output REAL(16) as 1PG43.34E4 rather than 1PG40.31E4. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/write.c -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #14 from ebotcazou at gcc dot gnu dot org 2006-04-01 21:34 --- Subject: Bug 24685 Author: ebotcazou Date: Sat Apr 1 21:34:27 2006 New Revision: 112611 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=112611 Log: PR libfortran/24685 * gfortran.dg/large_real_kind_form_io_2.f90: XFAIL on SPARC/Solaris. Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #15 from ebotcazou at gcc dot gnu dot org 2006-04-01 21:35 --- Subject: Bug 24685 Author: ebotcazou Date: Sat Apr 1 21:35:34 2006 New Revision: 112612 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=112612 Log: PR libfortran/24685 * gfortran.dg/large_real_kind_form_io_2.f90: XFAIL on SPARC/Solaris. Modified: branches/gcc-4_1-branch/gcc/testsuite/ChangeLog branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/large_real_kind_form_io_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #13 from jb at gcc dot gnu dot org 2006-03-16 08:30 --- (In reply to comment #12) The attached C program fails on IA64 because the printf rounds the last digit of MIN_LDBL down when it prints it and so it can't be read back in. The basic problem is that LDBL_MAX and LDBL_MIN (or for that matter DBL_MIN and DBL_MAX) cannot be represented exactly in decimal form so printf has to do some rounding that may make the process non-reversable when trying to go back via strtod or strtold. Ah, I see. Well, IMHO formatted IO of FOO_MAX/MIN is a rather obscure corner case, so I think a good enough solution would be to change the testcase to instead test with FOO_MAX/2 and FOO_MIN*2 (just to check that we have large enough field widths etc. and not worry about rounding out of range). But I'll ask the standards gurus on c.l.f first to make sure. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #11 from jb at gcc dot gnu dot org 2006-03-15 16:22 --- Tentative patch here: http://gcc.gnu.org/ml/gcc-patches/2006-03/msg00950.html -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #12 from sje at cup dot hp dot com 2006-03-15 16:44 --- At least on IA64, I don't think there is a way to make this test work. I tried a change similar to yours. I also changed the setting of ndigits (uses the magic number 27 in a couple of places), changed the number 31 in the sprintf statement and the number 32 (buffer size) in the snprintf statement. This fixed the LDBL_MAX problem but the test still failed on the LDBL_MIN part of the test. The attached C program fails on IA64 because the printf rounds the last digit of MIN_LDBL down when it prints it and so it can't be read back in. The basic problem is that LDBL_MAX and LDBL_MIN (or for that matter DBL_MIN and DBL_MAX) cannot be represented exactly in decimal form so printf has to do some rounding that may make the process non-reversable when trying to go back via strtod or strtold. I looked to see if there was a float or double version of this test and I didn't find one, if there was one I think it would fail on some platforms because the write/read sequence is not gauranteed to return the original value due to possible rounding during the writing and/or reading process. #include stdio.h #include float.h #include errno.h main() { char buffer[64]; long double x = LDBL_MIN; sprintf(buffer, %63.40Le, x); printf(==%s==\n, buffer); errno = 0; x = strtold(buffer, 0); printf(errno = %d\n, errno); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #10 from ebotcazou at gcc dot gnu dot org 2006-03-15 07:29 --- Please XFAIL the testcase on the relevant platforms. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #9 from sje at cup dot hp dot com 2006-02-23 17:44 --- I am still seeing this fail on ia64-hp-hpux11.23 which uses real*16. I believe the problem is in io/write.c (output_float). While write_real sets the maximum width to 40 for real*16, output_float still uses a 32 char buffer in sprintf to convert the number to a string so we still get more truncation than we should. I think this buffer should 40+ chars long. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #7 from fxcoudert at gcc dot gnu dot org 2006-02-16 11:12 --- OK, I think this is the same bug as reported on some ppc64-linux non-standard builds. It has to deal with real(16), and is indeed the very same kind of problem. This is not a bug introduced by the patch, it just wasn't exposed by the previous testcases. I'll investigate. -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added Status|REOPENED|ASSIGNED GCC target triplet|i686-pc-linux-gnu |sparc-solaris, powerpc64- ||linux Last reconfirmed|2006-02-05 22:19:58 |2006-02-16 11:12:44 date|| Summary|[4.1 only] real(10) |real(16) formatted input is |formatted input is broken |broken for huge values |for huge values | Target Milestone|4.1.0 |4.1.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685
[Bug libfortran/24685] real(16) formatted input is broken for huge values
--- Comment #8 from pinskia at gcc dot gnu dot org 2006-02-16 17:44 --- powerpc-darwin has the failure and it supports 128bit long double by default. powerpc64-linux does not which is why I am removing it from the target. -- pinskia at gcc dot gnu dot org changed: What|Removed |Added GCC target triplet|sparc-solaris, powerpc64- |sparc-solaris, powerpc- |linux |darwin Target Milestone|4.1.1 |--- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685