summaryrefslogtreecommitdiff
path: root/gcc/fortran/gfortran.texi
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-01 19:17:37 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-01 19:17:37 +0000
commitebcbc3356a31213c614cd9067a88d7b42eebe9ec (patch)
treeaca5715d2e2402e23f8d6fcb8a69bdb7516dab2e /gcc/fortran/gfortran.texi
parentb012e613100d33f9621f1a9594086450864cad13 (diff)
downloadgcc-ebcbc3356a31213c614cd9067a88d7b42eebe9ec.tar.gz
* intrinsic.c (add_conv): No longer take a "simplify" argument as
its always gfc_convert_constant, instead take a "standard" argument. (add_conversions): Change all existing calls of add_conv to pass GFC_STD_F77 as appropriate. Additionally, if we're allowing GNU extensions support integer-logical and logical-integer conversions. (gfc_convert_type_warn): Warn about use the use of these conversions as a extension when appropriate, i.e. with -pedantic. * simplify.c (gfc_convert_constant): Add support for integer to logical and logical to integer conversions, using gfc_int2log and gfc_log2int. * arith.c (gfc_log2int, gfc_int2log): New functions. * arith.h (gfc_log2int, gfc_int2log): Prototype here. * gfortran.texi: Document this new GNU extension. * gfortran.dg/logint-1.f: New test case. * gfortran.dg/logint-2.f: Likewise. * gfortran.dg/logint-3.f: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100461 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/gfortran.texi')
-rw-r--r--gcc/fortran/gfortran.texi17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index 7ea59096a62..50b64990985 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -637,6 +637,7 @@ of extensions, and @option{-std=legacy} allows both without warning.
* Hexadecimal constants::
* Real array indices::
* Unary operators::
+* Implicitly interconvert LOGICAL and INTEGER::
@end menu
@node Old-style kind specifications
@@ -793,6 +794,22 @@ operators without the need for parenthesis.
X = Y * -Z
@end smallexample
+@node Implicitly interconvert LOGICAL and INTEGER
+@section Implicitly interconvert LOGICAL and INTEGER
+@cindex Implicitly interconvert LOGICAL and INTEGER
+
+As a GNU extension for backwards compatability 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 non-zero value is interpreted as @code{.TRUE.}.
+
+@smallexample
+ INTEGER*4 i
+ i = .FALSE.
+@end smallexample
+
@include intrinsic.texi
@c ---------------------------------------------------------------------
@c Contributing