From 93cb9a5aa147c94d18c708fa67e6fcb546dd7391 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Sun, 31 Jul 2016 01:51:37 +0000 Subject: re PR fortran/41922 (Diagnostic: No location shown for overlappingly initialized EQUIVALENCEd character vars) 2016-07-30 Steven G. Kargl PR fortran/41922 * target-memory.c (expr_to_char): Pass in locus and use it in error messages. (gfc_merge_initializers): Ditto. * target-memory.h: Update prototype for gfc_merge_initializers (). * trans-common.c (get_init_field): Use the correct locus. 2016-07-30 Steven G. Kargl PR fortran/41922 * gfortran.dg/equiv_constraint_5.f90: Adjust the error message. * gfortran.dg/equiv_constraint_7.f90: Ditto. * gfortran.dg/pr41922.f90: New test. From-SVN: r238915 --- gcc/fortran/trans-common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/fortran/trans-common.c') diff --git a/gcc/fortran/trans-common.c b/gcc/fortran/trans-common.c index 4fdccc9..20ec69e 100644 --- a/gcc/fortran/trans-common.c +++ b/gcc/fortran/trans-common.c @@ -532,10 +532,15 @@ get_init_field (segment_info *head, tree union_type, tree *field_init, memset (chk, '\0', (size_t)length); for (s = head; s; s = s->next) if (s->sym->value) - gfc_merge_initializers (s->sym->ts, s->sym->value, + { + locus *loc = NULL; + if (s->sym->ns->equiv && s->sym->ns->equiv->eq) + loc = &s->sym->ns->equiv->eq->expr->where; + gfc_merge_initializers (s->sym->ts, s->sym->value, loc, &data[s->offset], &chk[s->offset], (size_t)s->length); + } for (i = 0; i < length; i++) CONSTRUCTOR_APPEND_ELT (v, NULL, build_int_cst (type, data[i])); -- cgit v1.1