[Patch, Fortran] PR fortran/37099: Wrong simplification of constant character arrays

Paul Richard Thomas paul.richard.thomas@gmail.com
Thu Sep 4 11:53:00 GMT 2008


Daniel,


> missing cloog).  Ok to commit?  If it is,
> should I also backport to 4.3?

OK for both, with the usual delay for 4.3, with one proviso below.

> Just a remark, I don't quite like the current test's name
> (string_compare_1.f90), but it is the only thing I came up with.  Do you
> have a better idea?  It's a reduced version of the test attached to the
> PR.  Do you think I should include those original tests, too?  (Both
> succeed with my fix, of course.)

I have been caught more than once with a reduced testcase revealing a
different problem to the original.  Finding the PR reopened because it
wasn'tactually fixed is an unpleasant surprise.  I would include the
original test.

> +
> +                     gcc_assert (p->ref->next);
> +                     gcc_assert (!p->ref->next->next);
> +                     gcc_assert (p->ref->next->type == REF_SUBSTRING);
> +
> +                     if (p->value.constructor)
> +                       {
> +                         const gfc_expr* first =
> p->value.constructor->expr;
> +                         gcc_assert (first->expr_type == EXPR_CONSTANT);
> +                         gcc_assert (first->ts.type == BT_CHARACTER);

Is there any reason to go so heavy on the gcc_asserts?  I don't have
anything against it but ask myself if you are anticipating problems
here?

Thanks for the patch

Paul



More information about the Fortran mailing list