[Bug fortran/18026] boz initialization of REALs fails
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026 Jackie Rosen jackie.rosen at hushmail dot com changed: What|Removed |Added CC||jackie.rosen at hushmail dot com --- Comment #18 from Jackie Rosen jackie.rosen at hushmail dot com --- *** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla.
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #16 from burnus at gcc dot gnu dot org 2007-12-08 21:47 --- Subject: Bug 18026 Author: burnus Date: Sat Dec 8 21:46:56 2007 New Revision: 130713 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=130713 Log: 2007-12-08 Tobias Burnus [EMAIL PROTECTED] PR fortran/34342 PR fortran/34345 PR fortran/18026 PR fortran/29471 * gfortran.texi (BOZ literal constants): Improve documentation and adapt for BOZ changes. * Make-lang.ini (resolve.o): Add target-memory.h dependency. * gfortran.h (gfc_expr): Add is_boz flag. * expr.c: Include target-memory.h. (gfc_check_assign): Support transferring BOZ for real/cmlx. * resolve.c: Include target-memory.h (resolve_ordinary_assign): Support transferring BOZ for real/cmlx. * target-memory.c (gfc_convert_boz): New function. * target-memory.c (gfc_convert_boz): Add prototype. * primary.c (match_boz_constant): Set is_boz, enable F95 error also without -pedantic, and allow for Fortran 2003 BOZ. (match_real_constant): Fix comment. * simplify.c * (simplify_cmplx,gfc_simplify_dble,gfc_simplify_float, gfc_simplify_real): Support Fortran 2003 BOZ. 2007-12-08 Tobias Burnus [EMAIL PROTECTED] PR fortran/34342 PR fortran/34345 PR fortran/18026 PR fortran/29471 * gfortran.dg/boz_8.f90: New. * gfortran.dg/boz_9.f90: New. * gfortran.dg/boz_10.f90: New. * gfortran.dg/boz_7.f90: Update dg-warning. * gfortran.dg/pr16433.f: Add dg-error. * gfortan.dg/ibits.f90: Update dg-warning. * gfortran.dg/unf_io_convert_1.f90: Update/delete dg-warning. * gfortran.dg/unf_io_convert_2.f90: Ditto. Added: trunk/gcc/testsuite/gfortran.dg/boz_10.f90 trunk/gcc/testsuite/gfortran.dg/boz_8.f90 trunk/gcc/testsuite/gfortran.dg/boz_9.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/Make-lang.in trunk/gcc/fortran/expr.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/gfortran.texi trunk/gcc/fortran/primary.c trunk/gcc/fortran/resolve.c trunk/gcc/fortran/simplify.c trunk/gcc/fortran/target-memory.c trunk/gcc/fortran/target-memory.h trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/boz_7.f90 trunk/gcc/testsuite/gfortran.dg/ibits.f90 trunk/gcc/testsuite/gfortran.dg/pr16433.f trunk/gcc/testsuite/gfortran.dg/unf_io_convert_1.f90 trunk/gcc/testsuite/gfortran.dg/unf_io_convert_2.f90 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #17 from burnus at gcc dot gnu dot org 2007-12-08 22:09 --- Fixed on the trunk (4.3.0). gfortran now transfers the BOZ in DATA inf / Z'7FF0' / DATA nan / Z'FFF8' / bitwise to the real/complex variables (contrary to g77 without needing an option such as -ftypeless-boz). Note: As this use of the BOZ is invalid Fortran 95 and 2003 syntax, it is rejected using -std=f95/-std=f2003. gfortran now also supports the Fortran 2003 syntax: r = real(some boz) For the exact description of the non-standard BOZ, see: http://gcc.gnu.org/onlinedocs/gfortran/BOZ-literal-constants.html (Wait a day for the update of that page.) -- burnus at gcc dot gnu dot org changed: What|Removed |Added Status|NEW |RESOLVED Resolution||FIXED Target Milestone|--- |4.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #14 from kargl at gcc dot gnu dot org 2007-08-06 17:30 --- *** Bug 33001 has been marked as a duplicate of this bug. *** -- kargl at gcc dot gnu dot org changed: What|Removed |Added CC||sliwa at cft dot edu dot pl http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #15 from kargl at gcc dot gnu dot org 2007-08-06 17:32 --- *** Bug 33002 has been marked as a duplicate of this bug. *** -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #11 from kargl at gcc dot gnu dot org 2006-10-23 17:10 --- *** Bug 29561 has been marked as a duplicate of this bug. *** -- kargl at gcc dot gnu dot org changed: What|Removed |Added CC||kloedej at knmi dot nl http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #12 from tobias dot burnus at physik dot fu-berlin dot de 2006-10-23 18:52 --- Cf. also bug 29471. In the Intel Fortran Compiler real :: r data r/some BOZ/ gives the same result as using the Fortran 2003 statement in ifort: real :: r r = real(some boz) (At least with the -switch fe_new_BOZ_constants.) Therefore, with Fortran 2003 BOZ support in place, implementing this in gfortran should then become easier. (Working around will also become easier.( (As gfortran accepts [integer] BOZ everywhere, it will also have the problem whether real( z'F' ) is meant as convert integer BOZ to integer and then to real or as convert real BOZ to real. Ifort gives a default warning for both -stand f95 and -stand f03, treating the BOZ differently for those two cases.) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #13 from sgk at troutmask dot apl dot washington dot edu 2006-10-23 19:39 --- Subject: Re: boz initialization of REALs fails On Mon, Oct 23, 2006 at 06:52:06PM -, tobias dot burnus at physik dot fu-berlin dot de wrote: In the Intel Fortran Compiler real :: r data r/some BOZ/ gives the same result as using the Fortran 2003 statement in ifort: real :: r r = real(some boz) (At least with the -switch fe_new_BOZ_constants.) (1) I'd need to see an example. (2) The 2 code examples are technically invalid F95. (3) The first code example is invalid in F2003. Therefore, with Fortran 2003 BOZ support in place, implementing this in gfortran should then become easier. (Working around will also become easier.( gfortran implements the F2003 intrepetation of a BOZ in a data statement. See the BIG comment in match_boz_constant. What is missing is gfortran does not retain knowledge that a BOZ was seen, so when you hit real r data r/some BOZ/ the assignment to r does not know the value can from a BOZ. Hence, a warning/error can't be issued. (As gfortran accepts [integer] BOZ everywhere, it will also have the problem whether real( z'F' ) is meant as convert integer BOZ to integer and then to real or as convert real BOZ to real. Ifort gives a default warning for both -stand f95 and -stand f03, treating the BOZ differently for those two cases.) I spent a few hours on Friday night and Saturday looking at the F2003 behavior for REAL(z'f'). My first attempt to handle this failed, which I don't understand. I have a plan B. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #7 from fxcoudert at gcc dot gnu dot org 2006-10-02 11:09 --- If it's a regression wrt g77, then it's not an enhancement, it's a bug. -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added CC||fxcoudert at gcc dot gnu dot ||org Severity|enhancement |normal GCC host triplet|i686-pc-linux-gnu | Keywords||rejects-valid Last reconfirmed|2006-03-05 03:41:04 |2006-10-02 11:09:35 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #8 from kargl at gcc dot gnu dot org 2006-10-02 16:47 --- Remove reject-valid keyword, again! Return this to enhancement. This is NOT a bug. g77 compatibility and the Fortran 95 standard have a conflict, and so IMNSHO the Fortran 95 standard wins. See comment #3. The Fortran 95 standard has quite explicit language concerning how a BOZ is handled in a DATA statement, and that is what gfortran implements. A BOZ is handled consistently so that the gfortran extension of allowing a BOZ in an assignment gives the same result as the DATA statement. troutmask:kargl[204] cat a.f90 PROGRAM GFCBUG19 DOUBLE PRECISION y, x DATA x / Z'7FF0' / ! Conforms to Fortran 95 standard y = Z'7FF0' ! gfortran extension print *, x, y END troutmask:kargl[205] gfc -o z a.f90 troutmask:kargl[206] ./z 9.218868437227405E+018 9.218868437227405E+018 If someone wants to create a patch to implement a -fbroken-boz-behavior option, then that's fine. OTOH, the user can use the bit manipulation functions and TRANSFER to create whatever bit pattern the user wants. Or, the user can use the -fno-range-check option and simply compute inf = 1./0. and nan = 0. / .0. -- kargl at gcc dot gnu dot org changed: What|Removed |Added CC||kargl at gcc dot gnu dot org Severity|normal |enhancement Keywords|rejects-valid | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #9 from anlauf at gmx dot de 2006-10-02 21:35 --- (In reply to comment #8) This is NOT a bug. g77 compatibility and the Fortran 95 standard have a conflict, and so IMNSHO the Fortran 95 standard wins. Gfortran unfortunately does not have a switch to compile legacy code in a way that is sufficiently compatible with g77. The (multiple) libraries that I use do use code similar to the example in quite a few places. I am not the author of these libraries, I just use them. Fortunately I can still use g77 on my platforms to compile the relevant set of files. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #10 from sgk at troutmask dot apl dot washington dot edu 2006-10-03 01:48 --- Subject: Re: boz initialization of REALs fails On Mon, Oct 02, 2006 at 09:35:11PM -, anlauf at gmx dot de wrote: This is NOT a bug. g77 compatibility and the Fortran 95 standard have a conflict, and so IMNSHO the Fortran 95 standard wins. Gfortran unfortunately does not have a switch to compile legacy code in a way that is sufficiently compatible with g77. Actually, gfortran does have -std=legacy. It, unfortunately, does not have code inside the appropriate IF statements to do what you want. The (multiple) libraries that I use do use code similar to the example in quite a few places. I am not the author of these libraries, I just use them. Have you submitted bug reports to the authors of these libraries? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #5 from guilloteau at obs dot u-bordeaux1 dot fr 2006-05-12 13:05 --- Created an attachment (id=11443) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11443action=view) A simple program showing that initialization of BOZ constants fails in modules. The test program shows initialization of BOZ constant failing when in a MODULE. The initialization would work if the module code was put in a simple INCLUDE file in Fortran-77 style. GNU Fortran 95 (GCC) 4.2.0 20060420 (experimental) on Cygwin (April 2006 update) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Comment #6 from kargl at gcc dot gnu dot org 2006-05-12 17:43 --- (In reply to comment #5) Created an attachment (id=11443) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11443action=view) [edit] A simple program showing that initialization of BOZ constants fails in modules. Please read Comment #3. Your code is invalid for several reasons. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-07-26 13:03 --- *** Bug 23074 has been marked as a duplicate of this bug. *** -- What|Removed |Added CC||p dot w dot draper at durham ||dot ac dot uk http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Additional Comments From kargl at gcc dot gnu dot org 2005-03-15 21:05 --- I've removed the reject-valid keyward because the code is not valid Fortran 95. From section 5.2.10, we have: If a data-statement-constant is a boz-literal-constant, the corresponding object shall be of type integer. A data-stmt-constant that is a boz-literal-constant is treated as if the constant were an int-literal- constant with a kind-param that specifies the representation method with the largest decimal exponent range supported by the processor. -- What|Removed |Added Keywords|rejects-valid | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026
[Bug fortran/18026] boz initialization of REALs fails
--- Additional Comments From tobi at gcc dot gnu dot org 2005-03-13 19:05 --- While the compile-time error has disappeared, we now give the following incorrect output at runtime: [EMAIL PROTECTED] tests]$ ./a.out 9.218868437227405E+018 1.89227389587E+019 [EMAIL PROTECTED] tests]$ The following testcase gives the expected result, though: PROGRAM GFCBUG19 integer*8 infi, nani DOUBLE PRECISION inf, nan equivalence (infi, inf), (nani, nan) !c IEEE exceptional values on Intel x87 DATA infi / Z'7FF0' / DATA nani / Z'FFF8' / print *, inf, nan END [EMAIL PROTECTED] tests]$ ./a.out +Infinity NaN [EMAIL PROTECTED] tests]$ -- What|Removed |Added Summary|gfortran: regression w.r.t. |boz initialization of REALs |g77, lacks -ftypeless-boz |fails http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18026