On 20 Feb 2015, at 3:09 AM, Gilles Gouaillardet wrote: > George, > > this is correctly handled in ompi_testany_f : > > /* Increment index by one for fortran conventions. Note that > all Fortran compilers have FALSE==0; we just need to check > for any nonzero value (because TRUE is not always 1) */ > > Cheers, > > Gilles
Beware, this has/may not always be the case. This is due to C's historical confusion/misuse of integers as boolean data types. On VAX hardware, the low bit was the only significant part of a Fortran LOGICAL data type, owing to the architectural support (Branch of Low Bit Set/Clear) for the low bit in a status word meaning success/failure. I doubt anyone uses VAXes and MPI, so this is not likely to cause users problems. See http://h71000.www7.hp.com/doc/82final/6443/6443pro_026.html: > 8.3 Logical Data Representations > > Logical data can be one, two, four, or eight bytes in length. > > The default size used for a LOGICAL data declaration without a kind parameter > (or size specifier) is LOGICAL (KIND=4) (same as LOGICAL*4), unless you do > one of the following: > > • Explicitly declare the length of a LOGICAL declaration by using a > kind parameter, such as LOGICAL (KIND=4). HP Fortran provides intrinsic > LOGICAL kinds of 1, 2, 4, and 8. Each LOGICAL kind number corresponds to > number of bytes used by that intrinsic representation. > You can also use a size specifier, such as LOGICAL*4, but be aware this is an > extension to the Fortran 90 standard. > > • Use the FORTRAN command /INTEGER_SIZE=nn qualifier to control the > size of default (without a kind parameter or size specifier) LOGICAL and > INTEGER declarations (see Section 2.3.26). > To improve performance, avoid using 2-byte or 1-byte logical declarations > (see Chapter 5). > > Intrinsic LOGICAL*1 or LOGICAL (KIND=1) values are stored in a single byte. > > Logical (intrinsic) values can also be stored in the following sizes of > contiguous bytes starting on an arbitrary byte boundary: > > • Two bytes (LOGICAL (KIND=2) or LOGICAL*2) > • Four bytes (LOGICAL (KIND=4) or LOGICAL*4) > • Eight bytes (LOGICAL (KIND=8) or LOGICAL*8) > > The low-order bit determines whether the logical value is true or false. > Logical variables can also be interpreted as integer data (an extension to > the Fortran 90 standard). For example, in addition to having logical values > .TRUE. and .FALSE., LOGICAL*1 data can also have values in the range --128 to > 127. > > LOGICAL*1, LOGICAL*2, LOGICAL*4, and LOGICAL*8 data representations appear in > Figure 8-5. Larry Baker US Geological Survey 650-329-5608 ba...@usgs.gov