08-289r1 To: J3 From: Malcolm Cohen Subject: Possible incompatibilities Date: 2008 November 18 1. The intrinsic function FRACTION On examination of the F2003 standard, it was found that FRACTION, RRSPACING and SPACING had internal contradictions. These were discussed by paper 07-200r1. As a result of processing that paper, the contradictions were removed in the Fortran 2008 draft but the defects have not yet been corrected in Fortran 2003, which remains inconsistent. Therefore this is not an incompatibility, since Fortran 2003 was not consistent. 2. The EXTERNAL attribute The claim that Fortran 77/90/95 allowed an external procedure to be given the EXTERNAL attribute within its own scoping unit is mistaken. Fortran 77 did not allow recursion and so did not allow a procedure to pass its own name as an actual argument. Fortran 90 did not intend to allow the EXTERNAL attribute to be specified for a procedure within its own scoping unit; however, this was not clearly stated, leading to F90 interp request 205. This interp request was eventually answered in F95 corrigendum 2 which inserted a clear statement of the prohibition. 3. The INTRINSIC attribute The claim that INTRINSIC forbids overriding intrinsic procedures seems to be based on a misreading of constraint C542 (this was C547 in F2003). The wording in this area is difficult to follow so the misreading is understandable; however, there is in fact no incompatibility intended. Editorial improvement to the exposition of the interaction between generic and the INTRINSIC attribute will be proposed in another paper. This area has subtle interactions so any change needs to be carefully considered. 4. Negative zero and SIGN The potential "different interpretation" of SIGN with negative zero is correctly noted in 1.5.5 Fortran 77 compatibility but has been accidentally deleted from 1.5.4 Fortran 90 compatibility; an edit is supplied to correct this. 4. Printing negative numbers FORTRAN 77 and Fortran 90 required the program PROGRAM MAIN PRINT '(SS,F4.1)', -0.01 END to print " 0.0", whereas Fortran 95 and onwards required this program to print "-0.0". This change in interpretation was accidentally omitted from the compatibility section in both the F95 and F2003 standards, as well as in the current CD. An edit is supplied to correct this. 5. Automatic arrays The definition of an automatic array was changed in Fortran 2003 and this may affect the interpretation of a program, in particular when a global SAVE statement is used. This change of interpretation was overlooked in the Fortran 2003 standard. An edit is supplied to correct this. 6. Edits to 08-007r2 [3:1.5.3p1, after last bullet item] Insert new bullet item " - \Thisstandard{} has fewer restrictions on initialization expressions than Fortran 95; this might affect whether a variable is considered to be automatic." {Change on interpretation with Fortran 2003.} [3:1.5.4p3+] Insert new paragraph with bullet list: "The following Fortran 90 features have different interpretations in \thisstandard. - If the processor can distinguish between positive and negative real zero, the behavior of the SIGN intrinsic function when the second argument is negative real zero is changed by this standard. - Fortran 90 required that formatted output never produce a floating point zero value with a minus sign; \thisstandard{} requires that a minus sign be produced if the internal value is negative." - \Thisstandard{} has fewer restrictions on initialization expressions than Fortran 90; this might affect whether a variable is considered to be automatic." {We accidentally omitted the first, and overlooked the second ... way back in Fortran 95. Perhaps because small changes in output are not actually incompatibilities? But we mention other ones, so we should mention this one too. The third one is the F2003 change propagated backwards.} [4:1.5.5, after last bullet item] Insert new bullet item "- F{\sc ortran} 77 required that formatted output never produce a floating point zero value with a minus sign; \thisstandard{} requires that a minus sign be produced if the internal value is negative." {The overlooked change affects F77 compatibility too. The F2003 change in init exprs does not affect F77 compatibility because it had no concept of automatic variable.} ===END===