error. */
static size_t
-expr_to_char (gfc_expr *e, unsigned char *data, unsigned char *chk, size_t len)
+expr_to_char (gfc_expr *e, locus *loc,
+ unsigned char *data, unsigned char *chk, size_t len)
{
int i;
int ptr;
continue;
ptr = TREE_INT_CST_LOW(DECL_FIELD_OFFSET(cmp->backend_decl))
+ TREE_INT_CST_LOW(DECL_FIELD_BIT_OFFSET(cmp->backend_decl))/8;
- expr_to_char (c->expr, &data[ptr], &chk[ptr], len);
+ expr_to_char (c->expr, loc, &data[ptr], &chk[ptr], len);
}
return len;
}
buffer = (unsigned char*)alloca (len);
len = gfc_target_encode_expr (e, buffer, len);
- for (i = 0; i < (int)len; i++)
+ for (i = 0; i < (int)len; i++)
{
if (chk[i] && (buffer[i] != data[i]))
{
- gfc_error ("Overlapping unequal initializers in EQUIVALENCE "
- "at %L", &e->where);
+ if (loc)
+ gfc_error ("Overlapping unequal initializers in EQUIVALENCE "
+ "at %L", loc);
+ else
+ gfc_error ("Overlapping unequal initializers in EQUIVALENCE "
+ "at %C");
return 0;
}
chk[i] = 0xFF;
the union declaration. */
size_t
-gfc_merge_initializers (gfc_typespec ts, gfc_expr *e, unsigned char *data,
+gfc_merge_initializers (gfc_typespec ts, gfc_expr *e, locus *loc,
+ unsigned char *data,
unsigned char *chk, size_t length)
{
size_t len = 0;
{
case EXPR_CONSTANT:
case EXPR_STRUCTURE:
- len = expr_to_char (e, &data[0], &chk[0], length);
-
+ len = expr_to_char (e, loc, &data[0], &chk[0], length);
break;
case EXPR_ARRAY:
if (mpz_cmp_si (c->offset, 0) != 0)
len = elt_size * (size_t)mpz_get_si (c->offset);
- len = len + gfc_merge_initializers (ts, c->expr, &data[len],
+ len = len + gfc_merge_initializers (ts, c->expr, loc, &data[len],
&chk[len], length - len);
}
break;
int gfc_target_interpret_expr (unsigned char *, size_t, gfc_expr *, bool);
/* Merge overlapping equivalence initializers for trans-common.c. */
-size_t gfc_merge_initializers (gfc_typespec, gfc_expr *,
+size_t gfc_merge_initializers (gfc_typespec, gfc_expr *, locus *,
unsigned char *, unsigned char *,
size_t);
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]));