Commit e8a25349 by Tobias Schlüter

re PR fortran/31266 (Spurious(?) warning about character truncation)

PR fortran/31266
fortran/
* primary.c (gfc_variable_attr): Don't copy string length if it
doesn't make sense.
* resolve.c (resolve_code): Clarify error message.
testsuite/
* gfortran.dg/char_assign_1.f90: New.

From-SVN: r123759
parent 690af379
2007-04-12 Tobias Schlüter <tobi@gcc.gnu.org>
PR fortran/31266
* primary.c (gfc_variable_attr): Don't copy string length if it
doesn't make sense.
* resolve.c (resolve_code): Clarify error message.
PR fortran/31471
* decl.c (gfc_match_end): Also check for construct name in END
FORALL and END WERE statements.
......
......@@ -1844,7 +1844,14 @@ gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
case REF_COMPONENT:
gfc_get_component_attr (&attr, ref->u.c.component);
if (ts != NULL)
*ts = ref->u.c.component->ts;
{
*ts = ref->u.c.component->ts;
/* Don't set the string length if a substring reference
follows. */
if (ts->type == BT_CHARACTER
&& ref->next && ref->next->type == REF_SUBSTRING)
ts->cl = NULL;
}
pointer = ref->u.c.component->pointer;
allocatable = ref->u.c.component->allocatable;
......
......@@ -5135,8 +5135,9 @@ resolve_code (gfc_code *code, gfc_namespace *ns)
rlen = mpz_get_si (code->expr2->ts.cl->length->value.integer);
if (rlen && llen && rlen > llen)
gfc_warning_now ("rhs of CHARACTER assignment at %L will be "
"truncated (%d/%d)", &code->loc, rlen, llen);
gfc_warning_now ("CHARACTER expression will be truncated "
"in assignment (%d/%d) at %L",
llen, rlen, &code->loc);
}
if (gfc_pure (NULL))
......
2007-04-12 Tobias Schlter <tobi@gcc.gnu.org>
PR fortran/31266
* gfortran.dg/char_assign_1.f90: New.
PR fortran/31471
* gfortran.dg/block_name_1.f90: New.
* gfortran.dg/block_name_2.f90: New.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment