On Mon, Mar 24, 2014 at 3:22 PM, Ondřej Čertík <[log in to unmask]> wrote: > On Mon, Mar 24, 2014 at 3:18 PM, Jeff Hammond <[log in to unmask]> wrote: >> On Mon, Mar 24, 2014 at 3:05 PM, Ondřej Čertík <[log in to unmask]> wrote: >>> Hi Bill, >>> >>> On Mon, Mar 24, 2014 at 1:50 PM, Bill Long <[log in to unmask]> wrote: >>>> >>>> On Mar 24, 2014, at 2:21 PM, Ondřej Čertík <[log in to unmask]> wrote: >>>> >>>>> On Mon, Mar 24, 2014 at 1:05 PM, Bill Long <[log in to unmask]> wrote: >>>>>> >>>>>> If there is no Fortran LOGICAL representation that matches the corresponding c _Bool then the value of c_bool in the iso_c_binding module should be -1. If that is what you find, then the compiler is behaving correctly. >>>>> >>>>> The value of c_bool on Intel on my machine is "1", however, the type >>>>> is not interoperable, unless you specify -fpscomp logical. Btw, Cray >>>>> seems to have the same issue, see the results from a colleague who has >>>>> access to Cray: https://gist.github.com/jeffhammond/9746080 >>>> >>>> I’m not sure what Jeff is doing. I tried the example codes in the github link with the Cray compiler and get: >> >> Either my shell scripting sucks or modules does not have well-behaved >> error code behavior. As a result, I was getting the Intel compiler >> when requesting the Cray one. I fixed it now and got the expected >> result, i.e. the same as Bill. > > Thanks Jeff for the follow up. I have written this issue up here (the last section of the page): http://www.fortran90.org/src/gotchas.html#c-fortran-interoperability-of-logical So hopefully more people will be aware of this issue now and use the proper compiler options. Ondrej