public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tobi at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/22495] Different ideas about .true. and .false. Date: Sat, 05 Nov 2005 23:06:00 -0000 [thread overview] Message-ID: <20051105230618.23598.qmail@sourceware.org> (raw) In-Reply-To: <bug-22495-10391@http.gcc.gnu.org/bugzilla/> ------- 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
next prev parent reply other threads:[~2005-11-05 23:06 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-22495-10391@http.gcc.gnu.org/bugzilla/> 2005-11-01 21:30 ` tobi at gcc dot gnu dot org 2005-11-01 21:36 ` tobi at gcc dot gnu dot org 2005-11-02 12:37 ` tobi at gcc dot gnu dot org 2005-11-05 22:05 ` tkoenig at gcc dot gnu dot org 2005-11-05 23:06 ` tobi at gcc dot gnu dot org [this message] 2005-11-05 23:20 ` tkoenig at gcc dot gnu dot org 2005-11-06 0:02 ` kargl at gcc dot gnu dot org 2005-11-06 0:22 ` tobi at gcc dot gnu dot org 2005-11-06 0:23 ` tobi at gcc dot gnu dot org 2005-11-06 0:32 ` kargl at gcc dot gnu dot org 2005-11-06 15:01 ` tkoenig at gcc dot gnu dot org 2006-01-29 23:30 ` tkoenig at gcc dot gnu dot org 2006-01-30 0:52 ` kargl at gcc dot gnu dot org 2006-01-30 6:44 ` tkoenig at gcc dot gnu dot org 2005-07-15 8:52 [Bug fortran/22495] New: " tkoenig at gcc dot gnu dot org 2005-07-15 22:19 ` [Bug fortran/22495] " pinskia at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20051105230618.23598.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).