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
This commit is contained in:
parent
690af37922
commit
e8a2534927
4 changed files with 19 additions and 3 deletions
|
@ -1,5 +1,10 @@
|
|||
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))
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2007-04-12 Tobias Schlüter <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.
|
||||
|
|
Loading…
Add table
Reference in a new issue