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

[RFC] PR29464 Slightly wrong error message for IF statement


Hi,

The most convenient way to solve these would perhaps be to provide a 1:1
map from gfc_exec_op to gfc_statement. We could then just say (e.g. in
gfc_resolve_blocks) something to the effect of


Index: resolve.c
===================================================================
--- resolve.c   (revision 117666)
+++ resolve.c   (working copy)
@@ -4745,21 +4745,14 @@
       switch (b->op)
        {
        case EXEC_IF:
-         if (t == SUCCESS && b->expr != NULL
-             && (b->expr->ts.type != BT_LOGICAL || b->expr->rank != 0))
-           gfc_error
-             ("ELSE IF clause at %L requires a scalar LOGICAL
              expression",
-              &b->expr->where);
-         break;
-
        case EXEC_WHERE:
          if (t == SUCCESS
              && b->expr != NULL
              && (b->expr->ts.type != BT_LOGICAL
                  || b->expr->rank == 0))
            gfc_error
-             ("WHERE/ELSEWHERE clause at %L requires a LOGICAL array",
-              &b->expr->where);
+             ("%s clause at %L requires a LOGICAL array",
+              gfc_ascii_op(b->op), &b->expr->where);
          break;
 
         case EXEC_GOTO:



Where gfc_ascii_op == gfc_ascii_statement if a direct mapping would be
introduced and a separate mapping function if we do not change
gfc_exec_op and gfc_statement to be congruent (where possible).

Does that sound reasonable?


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