This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Fri, Dec 28, 2012 at 12:31 AM, Tobias Burnus <burnus@net-b.de> wrote:a) The Fortran standard only defines LOGICAL(kind=C_Bool) as being interoperable with C - no other LOGICAL type. That matches GCC: With gcc (the C compiler) only _Bool is a BOOLEAN_TYPE with TYPE_PRECISION == 1. Hence, this patch rejects other logical kinds as dummy argument/result variable in BIND(C) procedures if -std=f2003/f2008/f2008ts is specified (using -pedantic, one gets a warning).Sorry, I don't understand, what is the -pedantic warning about if it's already rejected? Or do you mean std=gnu -pedantic?
Does this actually work robustly?b) As GNU extension, other logical kinds are accepted in BIND(C) procedures; however, as the main use of "LOGICAL(kind=4)" (for BIND(C) procedures) is to handle logical expressions which use C's int, one has to deal with all integer values and not only 0 and 1. Hence, a normal integer type is used internally in that case. That has been done to avoid surprises of users and hard to trace bugs.
E.g. if you have a logical but really integer under the covers, what happens if you equivalence it with a "normal" logical variable.
logical :: A integer :: B equivalence (A,B) A = .true. B = 1 if (A) ...
Or pass it as an argument to a procedure expecting a normal logical etc.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |