To: J3 J3/19-146 From: Jon Steidel for HPC Subject: Response to 19-132 Date: 2019-February-12 References: J3/19-132 Introduction ------------ Paper 19-132 proposes allowing a binary, octal or hexadecimal (BOZ) constant in contexts where an integer-literal-constant is currently allowed. Use cases include in initialization expressions, constructors, enumerators, logical expressions, and case selectors. Currently, BOZ-constants are allowed only as data-stmt-constants in DATA statements, or as arguments to a limited number of intrinsic functions. As noted in the paper, the INT intrinsic function may be used with a BOZ constant argument in these use cases. The proposal allows a user to skip calling INT with the BOZ constant argument and merely use the BOZ constant in place of the INT intrinsic call. Discussion ---------- Subgroup notes that many vendors actually already support extensions that allow BOZ-constants to be used in contexts where integer-constants are allowed. Testing various compilers show the following results: Cray gfortran* IBM Intel NAG PGI a) Y Y Y Y Y Y b) Y Y Y Y Y N c) Y Y Y N Y Y d) Y Y Y Y Y Y e) Y Y Y Y N Y where a) is initialization expressions, b) is constructors, c) is enumerators, d) is logical expressions, and e) is case selectors. * gfortran compiled with the -fno-range-check BOZ constants are semantically different from integer constants. An integer argument to the intrinsic function REAL results in a type conversion of the integer representation of the value of the argument to the real representation of that value. A BOZ constant argument to the REAL intrinsic function is essentially a TRANSFER function call, which moves the internal representation of the value of the constant into a result type of REAL without doing an integer to real conversion. Most compilers already provide extensions that perform this bit transfer to a real target without the use of REAL(). As an example, the test program real(8) :: r = z"4046800000000000" integer(8) :: i = z"4046800000000000" print *, r, i end compiles with multiple compilers and produces the equivelent of > ./a.out 45., 4631530004285489152 as output. (The hex constant z"4046800000000000" is the internal floating point representation of 45.). Subgroup is concerned allowing BOZ constants as integer constants would be confusing to users given this semantic difference. At this time, the BIT data-type proposal is still being considered as a feature for the next revision of the standard. If the BIT data-type proposal moves forward, the proposwd change in 19-132 is not longer needed. Subgroup recommends no further action on paper 19-132.