Example: implicit none real :: a,b if(a .nonex. b) stop end Expected: Error: Unknown user operator 'nonex' at (1)
Current gfortran result: Error: Operands of user operator 'nonex' at (1) are REAL(4)/REAL(4) NAG f95: Error: x.f90, line 3: Unknown operator .NONEX. ifort: fortcom: Error: x.f90, line 3: Dotted string neither a defined operator nor a structure component [NONEX] sunf95: "x.f90", Line = 3, Column = 8: ERROR: The operator "nonex" has not been declared as a user defined operator. I though one could simply change resolve.c's resolve_operator such as e.g. Index: resolve.c =================================================================== --- resolve.c (revision 123843) +++ resolve.c (working copy) @@ -2242,6 +2242,14 @@ goto bad_op; case INTRINSIC_USER: + if (NULL == gfc_find_symtree (gfc_current_ns->uop_root, + e->value.op.uop->name)) + { + sprintf (msg, _("Unknown operator '%s' at %%L"), + e->value.op.uop->name); + } + else + { if (op2 == NULL) sprintf (msg, _("Operand of user operator '%s' at %%L is %s"), e->value.op.uop->name, gfc_typename (&op1->ts)); @@ -2249,6 +2257,7 @@ sprintf (msg, _("Operands of user operator '%s' at %%L are %s/%s"), e->value.op.uop->name, gfc_typename (&op1->ts), gfc_typename (&op2->ts)); + } goto bad_op; However, this fails as "gfc_get_uop" automatically creates the symbol if it cannot find it. And putting it into matchexp.c's gfc_match_defined_op_name is of cause way too early. -- Summary: Better error message for not-found operator Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31580