[gfortran] Fix PR 19589

Steve Kargl sgk@troutmask.apl.washington.edu
Wed Jan 26 20:35:00 GMT 2005


The attached patch fixes PR 19589.  The program

      PROGRAM PR19589
      LOGICAL*1 L
      DATA  L /.TRUE./
      END

used to give the error
troutmask:sgk[212] gfc -o d d.f
Numeric success
 In file d.f:4

      DATA  L /.TRUE./                                                  
                    1
Error: Incompatible types in assignment at (1), LOGICAL(4) to LOGICAL(1)

while g77 compiles the above.

2005-01-26  Steven G. Kargl  <kargls@comcast.net>

       * expr.c (gfc_check_assign):  Check for conformance of logical operands

I've attached a testsuite program as well.

-- 
Steve
-------------- next part --------------
c  { dg-do run }
      PROGRAM PR19589
      LOGICAL*1 L
      DATA  L /.TRUE./
      IF (L .NEQV. .TRUE._1) call abort()
      END

-------------- next part --------------
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/expr.c,v
retrieving revision 1.19
diff -u -r1.19 expr.c
--- expr.c	18 Jan 2005 12:11:47 -0000	1.19
+++ expr.c	26 Jan 2005 20:24:04 -0000
@@ -1820,7 +1820,10 @@
       if (gfc_numeric_ts (&lvalue->ts) && gfc_numeric_ts (&rvalue->ts))
 	return SUCCESS;
 
-      gfc_error ("Incompatible types in assignment at %L, %s to %s",
+      if (lvalue->ts.type == BT_LOGICAL && rvalue->ts.type == BT_LOGICAL)
+	return SUCCESS;
+
+     gfc_error ("Incompatible types in assignment at %L, %s to %s",
 		 &rvalue->where, gfc_typename (&rvalue->ts),
 		 gfc_typename (&lvalue->ts));
 


More information about the Gcc-patches mailing list