This is the mail archive of the gcc-bugs@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]

[Bug fortran/47448] Invalid check for ASSIGNMENT(=)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47448

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
            Summary|Accepts invalid             |Invalid check for
                   |ASSIGNMENT(=) which         |ASSIGNMENT(=)
                   |overrides intrinsic         |
                   |assignment                  |

--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-25 08:30:41 UTC ---
Draft patch. The typo seems to go back to the commit for PR 37425, committed
2009-08-10.

However, it seems only to be an accepts-invalid regression. Before the valid
and the invalid form were rejected, currently only the valid form is rejected -
the invalid is accepted.

--- a/gcc/fortran/interface.c
+++ b/gcc/fortran/interface.c
@@ -654,11 +654,12 @@ gfc_check_operator_interface (gfc_symbol *sym,
gfc_intrinsic_op op,

       /* Allowed are (per F2003, 12.3.2.1.2 Defined assignments):
         - First argument an array with different rank than second,
-        - Types and kinds do not conform, and
+        - First argument is a scalar and second an array,
+        - Types and kinds do not conform, or
         - First argument is of derived type.  */
       if (sym->formal->sym->ts.type != BT_DERIVED
          && sym->formal->sym->ts.type != BT_CLASS
-         && (r1 == 0 || r1 == r2)
+         && (r2 == 0 || r1 == r2)
          && (sym->formal->sym->ts.type == sym->formal->next->sym->ts.type
              || (gfc_numeric_ts (&sym->formal->sym->ts)
                  && gfc_numeric_ts (&sym->formal->next->sym->ts))))


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