This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[patch, fortran, documentation] PR34532 - implicit conversion, Integer as logical


The documentation (5.11) indicates that

$> cat if.f90
  INTEGER :: i = 1
  IF (i) PRINT *, 'True'
  END

is valid in gfortran, but

$> gfortran -g if.f90
 In file if.f90:2

IF (i) PRINT *, 'True'
   1
Error: ELSE IF clause at (1) requires a scalar LOGICAL expression

As discussed in bugzilla, this is to fix the docs.


2007-12-25  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/34532
	* gfortran.texi: Fixed section about implicit conversion of logical 
	and integer variables.


Tested doc, dvi and html targets. Ok for trunk?

Regards
	Daniel
Index: gfortran.texi
===================================================================
--- gfortran.texi	(revision 131167)
+++ gfortran.texi	(working copy)
@@ -1165,12 +1165,17 @@ zero, and @code{.TRUE.} is interpreted a
 @code{.FALSE.} and any nonzero value is interpreted as @code{.TRUE.}.
 
 @smallexample
-       INTEGER :: i = 1
-       IF (i) PRINT *, 'True'
+        LOGICAL :: l
+        l = 1
+@end smallexample
+@smallexample
+        INTEGER :: i
+        i = .TRUE.
 @end smallexample
 
-However, there is no implicit conversion of @code{LOGICAL} and
-@code{INTEGER} values performed during I/O operations.
+However, there is no implicit conversion of @code{INTEGER} values in
+@code{if}-statements, nor of @code{LOGICAL} or @code{INTEGER} values
+in I/O operations.
 
 @node Hollerith constants support
 @section Hollerith constants support

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]