[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    [gfortran] Fix PR 19589
From:       Steve Kargl <sgk () troutmask ! apl ! washington ! edu>
Date:       2005-01-26 20:35:21
Message-ID: 20050126203521.GA38554 () troutmask ! apl ! washington ! edu
[Download RAW message or body]

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

["pr19589.f" (text/plain)]

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


["expr.c.diff" (text/plain)]

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));
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic