This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: PING [gfortran] PATCH Fix PR 19754 (with regressions)]
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 04 Mar 2005 22:14:00 +0100
- Subject: Re: PING [gfortran] PATCH Fix PR 19754 (with regressions)]
- References: <20050211003919.GE23495@troutmask.apl.washington.edu>
Steve Kargl wrote:
> 2005-02-03 Steven G. Kargl <kargls@comcast.net>
>
> * resolve.c (compare_shapes): New function.
> (resolve_operator): Use it.
> + for (i = 0; i < op1->rank; i++)
> + {
> + if (op1->shape != NULL && op2->shape != NULL)
> + {
This check can be moved outside the loop.
> -
> if (e->shape == NULL)
> - e->shape = gfc_copy_shape (op1->shape, op1->rank);
> -
> + {
> + e->shape = gfc_copy_shape (op1->shape, op1->rank);
> + if (compare_shapes(op1, op2) == FAILURE)
> + {
> + msg[0] = '\0';
> + goto bad_op;
> + }
> + }
> }
> else
> {
> @@ -1499,10 +1539,13 @@
> return t;
>
> bad_op:
> +
> if (gfc_extend_expr (e) == SUCCESS)
> return SUCCESS;
>
> - gfc_error (msg, &e->where);
> + if (msg[0] != '\0')
> + gfc_error (msg, &e->where);
> +
> return FAILURE;
> }
Error handling should be handled the same way as for the case where the ranks
don't match. The route through bad_op is for user-defined operators.
Also, you should add testcases which test for the new error message.
- Tobi