------- Comment #2 from burnus at gcc dot gnu dot org 2007-12-06 12:15 ------- Created an attachment (id=14702) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14702&action=view) Draft patch for further BOZ diagnostic
The attached patch shows how one could implement: - Error for initializing non-integers in DATA statements (invalid Fortran 2003/95) - Print a warning for real(BOZ), dble(BOZ) etc., which are interpreted different then required by Fortran 2003. Missing: - "REAL(BOZ)" does not print a warning, only "REAL(BOZ, kind)" works as for the former, gfc_simplify_real is not called. I need to find out what route is taken for REAL() and INT(). - The "boz == true" needs to be "falsed" as some point, esp. after "int(BOZ)" it shall not be present. (In principle, the warning could be replaced by a TRANSFER, which might be enough to get Fortran 2003 BOZ working.) Also missing: a) As soon as there is Fortran 2003 BOZ support, one needs to modify match_boz_constant. Currently, it gives with -std=f* an error if a BOZ is used outside DATA; in Fortran 2003 this is allowed in REAL() etc., but not elsewhere. b) One may think of treating real_variable = BOZ as real_variable = real(BOZ) instead of as real_variable = int(BOZ) But one has to think of how to handle real_variable = 0.0 + BOZ real_variable = 0 + BOZ etc. in this case. I think other compilers tread only "lhs = BOZ" as real BOZ and lhs = expression(BOZ) as integer BOZ, but one should do some tests to confirm this and state clearly in http://gcc.gnu.org/onlinedocs/gfortran/BOZ-literal-constants.html how BOZ are treated. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34342