PING [gfortran] PATCH Fix PR 19754 (with regressions)]
Tobias Schlüter
tobias.schlueter@physik.uni-muenchen.de
Fri Mar 4 21:14:00 GMT 2005
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
More information about the Gcc-patches
mailing list