From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23612 invoked by alias); 5 Nov 2005 23:06:19 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23599 invoked by uid 48); 5 Nov 2005 23:06:18 -0000 Date: Sat, 05 Nov 2005 23:06:00 -0000 Message-ID: <20051105230618.23598.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/22495] Different ideas about .true. and .false. In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "tobi at gcc dot gnu dot org" X-SW-Source: 2005-11/txt/msg00783.txt.bz2 List-Id: ------- Comment #6 from tobi at gcc dot gnu dot org 2005-11-05 23:06 ------- I did some further research, and while g77 didn't seem to have documented any of the details of how LOGICALs are implemented, we have the following in gfortran.texi:755: ---- @node Implicitly interconvert LOGICAL and INTEGER @section Implicitly interconvert LOGICAL and INTEGER @cindex Implicitly interconvert LOGICAL and INTEGER As a GNU extension for backwards compatibility with other compilers, @command{gfortran} allows the implicit conversion of LOGICALs to INTEGERs and vice versa. When converting from a LOGICAL to an INTEGER, the numeric value of @code{.FALSE.} is zero, and that of @code{.TRUE.} is one. When converting from INTEGER to LOGICAL, the value zero is interpreted as @code{.FALSE.} and any nonzero value is interpreted as @code{.TRUE.}. ---- And this is indeed true and consistent with what g77 does: schluter@pcl247d:~/src/tests> cat ugly.f LOGICAL L DO i=0,5 L = i PRINT *, l END DO END schluter@pcl247d:~/src/tests> gfortran ugly.f In file ugly.f:3 L = i 1 Warning: Extension: Conversion from INTEGER(4) to LOGICAL(4) at (1) schluter@pcl247d:~/src/tests> LD_LIBRARY_PATH=~/usr/lib ./a.out F T T T T T schluter@pcl247d:~/src/tests> g77 ugly.f -fugly-logint schluter@pcl247d:~/src/tests> ./a.out F T T T T T schluter@pcl247d:~/src/tests> (The INTEGER -> LOGICAL conversion is implemented as "i = l != 0" as verified by looking in the tree dumps.) I think we should be consistent. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22495