J3/14-220r1 To: J3 From: Nick Maclaren/Malcolm Cohen Subject: Interpretation of values of type C_BOOL Date: 2014 October 13 1. Introduction This paper answers the questions raised in 14-220. 2. Questions and answers Q1. If a Fortran variable of type LOGICAL(C_BOOL) is passed to a C function, is the Fortran processor required to represent .TRUE._C_BOOL by all bits zero except the one required bit? A1. The requirements for LOGICAL(C_BOOL) are that .TRUE._C_BOOL shall have the same internal representation as (_Bool)1. This follows from the interoperability requirements and the canonical truth values, and will be clarified (i.e. explicitly stated) in F2015. Q2. If a processor and its companion processor support a negative integer zero, is the Fortran processor required to represent .FALSE._C_BOOL by all bits zero? A2. The requirements are that .FALSE._C_BOOL shall have the same internal representation as (_Bool)0. This will be clarified in F2015. Q3. Is a companion processor allowed to return a non-zero value other than all bits zero except the least significant as an object of type LOGICAL(C_BOOL)? And, if it allowed to, is a Fortran processor required to treat it as equivalent to .TRUE._C_BOOL? A3. The only acceptable values of type LOGICAL are .TRUE._C_BOOL and .FALSE._C_BOOL; returning any other representation does not conform to the Fortran standard, as no interpretation is established (type LOGICAL only has two values). Q4. Is a companion processor allowed to return a zero value other than with all bits zero as an object of type LOGICAL(C_BOOL)? And, if it is allowed to, is a Fortran processor required to treat it as equivalent to .FALSE._C_BOOL. A4. Same as A3. ===END===