/* Array things
- Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
Contributed by Andy Vaught
This file is part of GCC.
#include "match.h"
#include <string.h>
-#include <assert.h>
/* This parameter is the size of the largest array constructor that we
will expand to an array constructor without iterators.
i = ar->dimen;
- ar->c_where[i] = *gfc_current_locus ();
+ ar->c_where[i] = gfc_current_locus;
ar->start[i] = ar->end[i] = ar->stride[i] = NULL;
/* We can't be sure of the difference between DIMEN_ELEMENT and
memset (ar, '\0', sizeof (ar));
- ar->where = *gfc_current_locus ();
+ ar->where = gfc_current_locus;
ar->as = as;
if (gfc_match_char ('(') != MATCH_YES)
{
gfc_constructor *c, *pre;
expr_t type;
+ int t;
type = base->expr_type;
{
if (type == EXPR_ARRAY)
{
- if (mpz_cmp (c->n.offset, c1->n.offset) < 0)
+ t = mpz_cmp (c->n.offset, c1->n.offset);
+ if (t < 0)
{
pre = c;
c = c->next;
}
- else if (mpz_cmp (c->n.offset, c1->n.offset) == 0)
+ else if (t == 0)
{
gfc_error ("duplicated initializer");
break;
match m;
int n;
- old_loc = *gfc_current_locus ();
+ old_loc = gfc_current_locus;
if (gfc_match_char ('(') == MATCH_NO)
return MATCH_NO;
e->value.constructor = head;
p = gfc_get_constructor ();
- p->where = *gfc_current_locus ();
+ p->where = gfc_current_locus;
p->iterator = gfc_get_iterator ();
*p->iterator = iter;
cleanup:
gfc_free_constructor (head);
gfc_free_iterator (&iter, 0);
- gfc_set_locus (&old_loc);
+ gfc_current_locus = old_loc;
return m;
}
return m;
p = gfc_get_constructor ();
- p->where = *gfc_current_locus ();
+ p->where = gfc_current_locus;
p->expr = expr;
*result = p;
if (gfc_match (" (/") == MATCH_NO)
return MATCH_NO;
- where = *gfc_current_locus ();
+ where = gfc_current_locus;
head = tail = NULL;
if (gfc_match (" /)") == MATCH_YES)
{
if (cons_state == CONS_BAD)
- return 0; /* Supress further errors */
+ return 0; /* Suppress further errors */
if (cons_state == CONS_START)
{
/********* Subroutines for determining the size of an array *********/
-/* These are needed just to accomodate RESHAPE(). There are no
+/* These are needed just to accommodate RESHAPE(). There are no
diagnostics here, we just return a negative number if something
goes wrong. */
return &ref->u.ar;
}
+
+
+/* Find out if an array shape is known at compile time. */
+
+int
+gfc_is_compile_time_shape (gfc_array_spec *as)
+{
+ int i;
+
+ if (as->type != AS_EXPLICIT)
+ return 0;
+
+ for (i = 0; i < as->rank; i++)
+ if (!gfc_is_constant_expr (as->lower[i])
+ || !gfc_is_constant_expr (as->upper[i]))
+ return 0;
+
+ return 1;
+}