+2013-04-09 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/56852
+ * primary.c (gfc_variable_attr): Avoid ICE on AR_UNKNOWN if any
+ of the index variables are untyped and errors are present.
+
2015-04-07 Andre Vehreschild <vehre@gmx.de>
PR fortran/65548
then, which calls ->vptr->copy () with four arguments adding
the length information ->vptr->copy(from, to, from_len, to_cap).
(gfc_conv_procedure_call): Switch to new function name for
- getting a class' vtab's field.
+ getting a class' vtab's field.
(alloc_scalar_allocatable_for_assignment): Use the string_length
as computed by gfc_conv_expr and not the statically backend_decl
which may be incorrect when ref-ing.
Added gfc_find_and_cut_at_last_class_ref () and
gfc_reset_len () routine prototype. Added flag to
gfc_copy_class_to_class () prototype to signal an unlimited
- polymorphic entity to copy.
+ polymorphic entity to copy.
2015-03-24 Iain Sandoe <iain@codesourcery.com>
Tobias Burnus <burnus@net-b.de>
/* Match the digit string part of an integer if signflag is not set,
- the signed digit string part if signflag is set. If the buffer
- is NULL, we just count characters for the resolution pass. Returns
+ the signed digit string part if signflag is set. If the buffer
+ is NULL, we just count characters for the resolution pass. Returns
the number of characters matched, -1 for no match. */
static int
}
-/* Match an integer (digit string and optional kind).
+/* Match an integer (digit string and optional kind).
A sign will be accepted if signflag is set. */
static match
gfc_expr *e = NULL;
const char *msg;
int num, pad;
- int i;
+ int i;
old_loc = gfc_current_locus;
gfc_gobble_whitespace ();
if (seen_dp)
goto done;
- /* Check to see if "." goes with a following operator like
+ /* Check to see if "." goes with a following operator like
".eq.". */
temp_loc = gfc_current_locus;
c = gfc_next_ascii_char ();
if (sym->attr.in_common && !sym->attr.proc_pointer)
{
- if (!gfc_add_flavor (&sym->attr, FL_VARIABLE,
+ if (!gfc_add_flavor (&sym->attr, FL_VARIABLE,
sym->name, &sym->declared_at))
return MATCH_ERROR;
break;
symbol_attribute
gfc_variable_attr (gfc_expr *expr, gfc_typespec *ts)
{
- int dimension, codimension, pointer, allocatable, target;
+ int dimension, codimension, pointer, allocatable, target, n;
symbol_attribute attr;
gfc_ref *ref;
gfc_symbol *sym;
break;
case AR_UNKNOWN:
- gfc_internal_error ("gfc_variable_attr(): Bad array reference");
+ /* If any of start, end or stride is not integer, there will
+ already have been an error issued. */
+ for (n = 0; n < ref->u.ar.as->rank; n++)
+ {
+ int errors;
+ gfc_get_errors (NULL, &errors);
+ if (((ref->u.ar.start[n]
+ && ref->u.ar.start[n]->ts.type == BT_UNKNOWN)
+ ||
+ (ref->u.ar.end[n]
+ && ref->u.ar.end[n]->ts.type == BT_UNKNOWN)
+ ||
+ (ref->u.ar.stride[n]
+ && ref->u.ar.stride[n]->ts.type == BT_UNKNOWN))
+ && errors > 0)
+ break;
+ }
+ if (n == ref->u.ar.as->rank)
+ gfc_internal_error ("gfc_variable_attr(): Bad array reference");
}
break;
&gfc_current_locus);
value->ts = comp->ts;
- if (!build_actual_constructor (comp_head,
- &value->value.constructor,
+ if (!build_actual_constructor (comp_head,
+ &value->value.constructor,
comp->ts.u.derived))
{
gfc_free_expr (value);
actual->expr = NULL;
/* Check if this component is already given a value. */
- for (comp_iter = comp_head; comp_iter != comp_tail;
+ for (comp_iter = comp_head; comp_iter != comp_tail;
comp_iter = comp_iter->next)
{
gcc_assert (comp_iter);
expr->expr_type = EXPR_STRUCTURE;
}
- gfc_current_locus = old_locus;
+ gfc_current_locus = old_locus;
if (parent)
*arglist = actual;
return true;
cleanup:
- gfc_current_locus = old_locus;
+ gfc_current_locus = old_locus;
for (comp_iter = comp_head; comp_iter; )
{
|| sym->ns == gfc_current_ns->parent))
{
gfc_entry_list *el = NULL;
-
+
for (el = sym->ns->entries; el; el = el->next)
if (sym == el->sym)
goto variable;
case FL_PARAMETER:
/* A statement of the form "REAL, parameter :: a(0:10) = 1" will
- end up here. Unfortunately, sym->value->expr_type is set to
+ end up here. Unfortunately, sym->value->expr_type is set to
EXPR_CONSTANT, and so the if () branch would be followed without
the !sym->as check. */
if (sym->value && sym->value->expr_type != EXPR_ARRAY && !sym->as)
if (m2 != MATCH_YES)
{
/* Try to figure out whether we're dealing with a character type.
- We're peeking ahead here, because we don't want to call
+ We're peeking ahead here, because we don't want to call
match_substring if we're dealing with an implicitly typed
non-character variable. */
implicit_char = false;
e->expr_type = EXPR_VARIABLE;
if (sym->attr.flavor != FL_VARIABLE
- && !gfc_add_flavor (&sym->attr, FL_VARIABLE,
+ && !gfc_add_flavor (&sym->attr, FL_VARIABLE,
sym->name, NULL))
{
m = MATCH_ERROR;
implicit_ns = gfc_current_ns;
else
implicit_ns = sym->ns;
-
+
if (gfc_peek_ascii_char () == '%'
&& sym->ts.type == BT_UNKNOWN
&& gfc_get_default_type (sym->name, implicit_ns)->type == BT_DERIVED)