is_sym_host_assoc (gfc_symbol *sym, gfc_namespace *ns)
{
for (ns = ns->parent; ns; ns = ns->parent)
- {
+ {
if (sym->ns == ns)
return true;
}
sym->ts = ifc->result->ts;
sym->result = sym;
}
- else
+ else
sym->ts = ifc->ts;
sym->ts.interface = ifc;
sym->attr.function = ifc->attr.function;
}
}
- /* Fortran 95 Draft Standard, page 51, Section 5.1.1.5, on the Character
+ /* Fortran 95 Draft Standard, page 51, Section 5.1.1.5, on the Character
type, lists the only ways a character length value of * can be used:
dummy arguments of procedures, named constants, and function results
in external functions. Internal function results and results of module
return 0;
gfc_find_symbol (sym->name, sym->ns->parent, 1, &s);
-
+
if (s != NULL)
{
if (s == sym)
int n;
gfc_interface *p;
gfc_symbol *sym;
-
+
n = 0;
sym = e->symtree->n.sym;
gfc_warning ("Non-RECURSIVE procedure '%s' at %L is possibly calling"
" itself recursively. Declare it RECURSIVE or use"
" -frecursive", sym->name, &expr->where);
-
+
return SUCCESS;
}
with the same name before emitting an error. */
if (sym->attr.generic && count_specific_procs (e) != 1)
return FAILURE;
-
+
/* Just in case a specific was found for the expression. */
sym = e->symtree->n.sym;
else if (c && c->ext.actual != NULL)
{
arg0 = c->ext.actual;
-
+
if (c->resolved_sym)
esym = c->resolved_sym;
else
&& !(gfc_option.warn_std & GFC_STD_GNU)))
gfc_errors_to_warnings (1);
- if (sym->attr.if_source != IFSRC_IFBODY)
+ if (sym->attr.if_source != IFSRC_IFBODY)
gfc_procedure_use (def_sym, actual, where);
gfc_errors_to_warnings (0);
{
/* We have constant lower and upper bounds. If the
difference between is 1, it can be considered a
- scalar.
+ scalar.
FIXME: Use gfc_dep_compare_expr instead. */
start = (int) mpz_get_si
(ref->u.ar.as->lower[0]->value.integer);
the actual expression could be a part-ref of the expr symbol. */
arg_ts = &(args->expr->ts);
arg_attr = gfc_expr_attr (args->expr);
-
+
if (sym->intmod_sym_id == ISOCBINDING_ASSOCIATED)
{
/* If the user gave two args then they are providing something for
if (seen_section && retval == SUCCESS)
gfc_warning ("Array section in '%s' call at %L", name,
&(args->expr->where));
-
+
/* See if we have interoperable type and type param. */
if (gfc_verify_c_interop (arg_ts) == SUCCESS
|| gfc_check_any_c_kind (arg_ts) == SUCCESS)
is not an array of zero size. */
if (args_sym->attr.allocatable == 1)
{
- if (args_sym->attr.dimension != 0
+ if (args_sym->attr.dimension != 0
&& (args_sym->as && args_sym->as->rank == 0))
{
gfc_error_now ("Allocatable variable '%s' used as a "
retval = FAILURE;
}
}
-
+
/* Make sure it's not a character string. Arrays of
any type should be ok if the variable is of a C
interoperable type. */
with no length type parameters. It still must have either
the pointer or target attribute, and it can be
allocatable (but must be allocated when c_loc is called). */
- if (args->expr->rank != 0
+ if (args->expr->rank != 0
&& is_scalar_expr_ptr (args->expr) != SUCCESS)
{
gfc_error_now ("Parameter '%s' to '%s' at %L must be a "
&(args->expr->where));
retval = FAILURE;
}
- else if (arg_ts->type == BT_CHARACTER
+ else if (arg_ts->type == BT_CHARACTER
&& is_scalar_expr_ptr (args->expr) != SUCCESS)
{
gfc_error_now ("CHARACTER argument '%s' to '%s' at "
retval = FAILURE;
}
}
-
+
/* for c_loc/c_funloc, the new symbol is the same as the old one */
*new_sym = sym;
}
/* If this is a procedure pointer component, it has already been resolved. */
if (gfc_is_proc_ptr_comp (expr, NULL))
return SUCCESS;
-
+
if (sym && sym->attr.intrinsic
&& resolve_intrinsic (sym, &expr->where) == FAILURE)
return FAILURE;
}
inquiry_argument = false;
-
+
/* Need to setup the call to the correct c_associated, depending on
the number of cptrs to user gives to compare. */
if (sym && sym->attr.is_iso_c == 1)
if (gfc_iso_c_func_interface (sym, expr->value.function.actual, &sym)
== FAILURE)
return FAILURE;
-
+
/* Get the symtree for the new symbol (resolved func).
the old one will be freed later, when it's no longer used. */
gfc_find_sym_tree (sym->name, sym->ns, 1, &(expr->symtree));
}
-
+
/* Resume assumed_size checking. */
need_full_assumed_size--;
sprintf (name, "%s_%c%d", sym->name, type, kind);
/* Set up the binding label as the given symbol's label plus
the type and kind. */
- *binding_label = gfc_get_string ("%s_%c%d", sym->binding_label, type,
+ *binding_label = gfc_get_string ("%s_%c%d", sym->binding_label, type,
kind);
}
else
sprintf (name, "%s", sym->name);
*binding_label = sym->binding_label;
}
-
+
return;
}
/* default to success; will override if find error */
match m = MATCH_YES;
- /* Make sure the actual arguments are in the necessary order (based on the
+ /* Make sure the actual arguments are in the necessary order (based on the
formal args) before resolving. */
gfc_procedure_use (sym, &c->ext.actual, &(c->loc));
(sym->intmod_sym_id == ISOCBINDING_F_PROCPOINTER))
{
set_name_and_label (c, sym, name, &binding_label);
-
+
if (sym->intmod_sym_id == ISOCBINDING_F_POINTER)
{
if (c->ext.actual != NULL && c->ext.actual->next != NULL)
gfc_procedure_use() (called above to sort actual args). */
if (c->ext.actual->next->expr->rank != 0)
{
- if(c->ext.actual->next->next == NULL
+ if(c->ext.actual->next->next == NULL
|| c->ext.actual->next->next->expr == NULL)
{
m = MATCH_ERROR;
}
}
}
-
+
if (m != MATCH_ERROR)
{
/* the 1 means to add the optional arg to formal list */
new_sym = get_iso_c_sym (sym, name, binding_label, 1);
-
+
/* for error reporting, say it's declared where the original was */
new_sym->declared_at = sym->declared_at;
}
c->resolved_sym = new_sym;
else
c->resolved_sym = sym;
-
+
return m;
}
m = gfc_iso_c_sub_interface (c,sym);
return m;
}
-
+
if (sym->attr.external || sym->attr.if_source == IFSRC_IFBODY)
{
if (sym->attr.dummy)
if (op1->ts.type == BT_LOGICAL && op2->ts.type == BT_LOGICAL)
sprintf (msg,
_("Logicals at %%L must be compared with %s instead of %s"),
- (e->value.op.op == INTRINSIC_EQ
+ (e->value.op.op == INTRINSIC_EQ
|| e->value.op.op == INTRINSIC_EQ_OS)
? ".eqv." : ".neqv.", gfc_op2string (e->value.op.op));
else
}
-/* Compute the last value of a sequence given by a triplet.
+/* Compute the last value of a sequence given by a triplet.
Return 0 if it wasn't able to compute the last value, or if the
sequence if empty, and 1 otherwise. */
e->value.function.esym = NULL;
e->symtree = st;
- if (new_ref)
+ if (new_ref)
e->ref = new_ref;
/* '_vptr' points to the vtab, which contains the procedure pointers. */
if (t == SUCCESS && e->ts.type == BT_CHARACTER)
{
/* For efficiency, we call gfc_expand_constructor for BT_CHARACTER
- here rather then add a duplicate test for it above. */
+ here rather then add a duplicate test for it above. */
gfc_expand_constructor (e, false);
t = gfc_resolve_character_array_constructor (e);
}
{
if (expr->expr_type != EXPR_VARIABLE)
return false;
-
+
/* A scalar assignment */
if (!expr->ref || *f == 1)
{
/* Used in resolve_allocate_expr to check that a allocation-object and
- a source-expr are conformable. This does not catch all possible
+ a source-expr are conformable. This does not catch all possible
cases; in particular a runtime checking is needed. */
static gfc_try
{
gfc_ref *tail;
for (tail = e2->ref; tail && tail->next; tail = tail->next);
-
+
/* First compare rank. */
if (tail && e1->rank != tail->u.ar.as->rank)
{
using _copy and trans_call. It is convenient to exploit that
when the allocated type is different from the declared type but
no SOURCE exists by setting expr3. */
- code->expr3 = gfc_default_initializer (&code->ext.alloc.ts);
+ code->expr3 = gfc_default_initializer (&code->ext.alloc.ts);
}
else if (!code->expr3)
{
/* This is a potential collision. */
gfc_ref *pr = pe->ref;
gfc_ref *qr = qe->ref;
-
+
/* Follow the references until
a) They start to differ, in which case there is no error;
you can deallocate a%b and a%c in a single statement
if (pr->u.c.component->name != qr->u.c.component->name)
break;
}
-
+
pr = pr->next;
qr = qr->next;
}
/* Callback function for our mergesort variant. Determines interval
overlaps for CASEs. Return <0 if op1 < op2, 0 for overlap, >0 for
- op1 > op2. Assumes we're not dealing with the default case.
+ op1 > op2. Assumes we're not dealing with the default case.
We have op1 = (:L), (K:L) or (K:) and op2 = (:N), (M:N) or (M:).
There are nine situations to check. */
default_case = body;
}
}
-
+
if (error > 0)
return;
assoc->target = gfc_copy_expr (code->expr2);
assoc->target->where = code->expr2->where;
/* assoc->variable will be set by resolve_assoc_var. */
-
+
code->ext.block.assoc = assoc;
code->expr1->symtree->n.sym->assoc = assoc;
resolve_assoc_var (st->n.sym, false);
}
-
+
/* Take out CLASS IS cases for separate treatment. */
body = code;
while (body && body->block)
{
/* Add to class_is list. */
if (class_is == NULL)
- {
+ {
class_is = body->block;
tail = class_is;
}
if (class_is)
{
gfc_symbol *vtab;
-
+
if (!default_case)
{
/* Add a default case to hold the CLASS IS cases. */
}
while (swapped);
}
-
+
/* Generate IF chain. */
if_st = gfc_get_code ();
if_st->op = EXEC_IF;
new_st->op = EXEC_IF;
new_st->next = default_case->next;
}
-
+
/* Replace CLASS DEFAULT code by the IF chain. */
default_case->next = if_st;
}
/* Resolve a transfer statement. This is making sure that:
-- a derived type being transferred has only non-pointer components
- -- a derived type being transferred doesn't have private components, unless
+ -- a derived type being transferred doesn't have private components, unless
it's being transferred from the module where the type was defined
-- we're not trying to transfer a whole assumed size array. */
/* Find the set of labels that are reachable from this block. We also
record the last statement in each block. */
-
+
static void
find_reachable_labels (gfc_code *block)
{
"inconsistent shape", &cnext->expr1->where);
break;
-
+
case EXEC_ASSIGN_CALL:
resolve_call (cnext);
if (!cnext->resolved_sym->attr.elemental)
case EXEC_ASSIGN:
gfc_resolve_assign_in_forall (cnext, nvar, var_expr);
break;
-
+
/* WHERE operator assignment statement */
case EXEC_ASSIGN_CALL:
resolve_call (cnext);
/* Counts the number of iterators needed inside a forall construct, including
- nested forall constructs. This is used to allocate the needed memory
+ nested forall constructs. This is used to allocate the needed memory
in gfc_resolve_forall. */
-static int
+static int
gfc_count_forall_iterators (gfc_code *code)
{
int max_iters, sub_iters, current_iters;
for (fa = code->ext.forall_iterator; fa; fa = fa->next)
current_iters ++;
-
+
code = code->block->next;
while (code)
- {
+ {
if (code->op == EXEC_FORALL)
{
sub_iters = gfc_count_forall_iterators (code);
if (sym->value->expr_type == EXPR_STRUCTURE)
t= resolve_structure_cons (sym->value, 1);
- else
+ else
t = gfc_resolve_expr (sym->value);
if (t == FAILURE)
{
gfc_gsymbol *binding_label_gsym;
gfc_gsymbol *comm_name_gsym;
- const char * bind_label = comm_block_tree->n.common->binding_label
+ const char * bind_label = comm_block_tree->n.common->binding_label
? comm_block_tree->n.common->binding_label : "";
/* See if a global symbol exists by the common block's name. It may
check and nothing to add as a global symbol for the label. */
if (!comm_block_tree->n.common->binding_label)
return;
-
+
binding_label_gsym =
gfc_find_gsymbol (gfc_gsym_root,
comm_block_tree->n.common->binding_label);
comm_name_gsym->name, &(comm_name_gsym->where));
}
}
-
+
return;
}
if (derived_sym != NULL && derived_sym->attr.flavor == FL_DERIVED
&& derived_sym->attr.is_bind_c == 1)
verify_bind_c_derived_type (derived_sym);
-
+
return;
}
-/* Verify that any binding labels used in a given namespace do not collide
+/* Verify that any binding labels used in a given namespace do not collide
with the names or binding labels of any global symbols. */
static void
gfc_verify_binding_labels (gfc_symbol *sym)
{
int has_error = 0;
-
- if (sym != NULL && sym->attr.is_bind_c && sym->attr.is_iso_c == 0
+
+ if (sym != NULL && sym->attr.is_bind_c && sym->attr.is_iso_c == 0
&& sym->attr.flavor != FL_DERIVED && sym->binding_label)
{
gfc_gsymbol *bind_c_sym;
bind_c_sym = gfc_find_gsymbol (gfc_gsym_root, sym->binding_label);
- if (bind_c_sym != NULL
+ if (bind_c_sym != NULL
&& strcmp (bind_c_sym->name, sym->binding_label) == 0)
{
- if (sym->attr.if_source == IFSRC_DECL
- && (bind_c_sym->type != GSYM_SUBROUTINE
- && bind_c_sym->type != GSYM_FUNCTION)
- && ((sym->attr.contained == 1
- && strcmp (bind_c_sym->sym_name, sym->name) != 0)
- || (sym->attr.use_assoc == 1
+ if (sym->attr.if_source == IFSRC_DECL
+ && (bind_c_sym->type != GSYM_SUBROUTINE
+ && bind_c_sym->type != GSYM_FUNCTION)
+ && ((sym->attr.contained == 1
+ && strcmp (bind_c_sym->sym_name, sym->name) != 0)
+ || (sym->attr.use_assoc == 1
&& (strcmp (bind_c_sym->mod_name, sym->module) != 0))))
{
/* Make sure global procedures don't collide with anything. */
&(bind_c_sym->where));
has_error = 1;
}
- else if (sym->attr.contained == 0
- && (sym->attr.if_source == IFSRC_IFBODY
- && sym->attr.flavor == FL_PROCEDURE)
- && (bind_c_sym->sym_name != NULL
+ else if (sym->attr.contained == 0
+ && (sym->attr.if_source == IFSRC_IFBODY
+ && sym->attr.flavor == FL_PROCEDURE)
+ && (bind_c_sym->sym_name != NULL
&& strcmp (bind_c_sym->sym_name, sym->name) != 0))
{
/* Make sure procedures in interface bodies don't collide. */
&(bind_c_sym->where));
has_error = 1;
}
- else if (sym->attr.contained == 0
+ else if (sym->attr.contained == 0
&& sym->attr.if_source == IFSRC_UNKNOWN)
if ((sym->attr.use_assoc && bind_c_sym->mod_name
- && strcmp (bind_c_sym->mod_name, sym->module) != 0)
+ && strcmp (bind_c_sym->mod_name, sym->module) != 0)
|| sym->attr.use_assoc == 0)
{
gfc_error ("Binding label '%s' at %L collides with global "
/* Build an initializer for a local integer, real, complex, logical, or
character variable, based on the command line flags finit-local-zero,
- finit-integer=, finit-real=, finit-logical=, and finit-runtime. Returns
+ finit-integer=, finit-real=, finit-logical=, and finit-runtime. Returns
null if the symbol should not have a default initialization. */
static gfc_expr *
build_default_init_expr (gfc_symbol *sym)
characters, and only if the corresponding command-line flags
were set. Otherwise, we free init_expr and return null. */
switch (sym->ts.type)
- {
+ {
case BT_INTEGER:
if (gfc_option.flag_init_integer != GFC_INIT_INTEGER_OFF)
- mpz_set_si (init_expr->value.integer,
+ mpz_set_si (init_expr->value.integer,
gfc_option.flag_init_integer_value);
else
{
break;
}
break;
-
+
case BT_COMPLEX:
switch (gfc_option.flag_init_real)
{
break;
}
break;
-
+
case BT_LOGICAL:
if (gfc_option.flag_init_logical == GFC_INIT_LOGICAL_FALSE)
init_expr->value.logical = 0;
init_expr = NULL;
}
break;
-
+
case BT_CHARACTER:
- /* For characters, the length must be constant in order to
+ /* For characters, the length must be constant in order to
create a default initializer. */
if (gfc_option.flag_init_character == GFC_INIT_CHARACTER_ON
&& sym->ts.u.cl->length
init_expr->value.function.actual = arg;
}
break;
-
+
default:
gfc_free_expr (init_expr);
init_expr = NULL;
/* For saved variables, we don't want to add an initializer at function
entry, so we just add a static initializer. Note that automatic variables
are stack allocated even with -fno-automatic. */
- if (sym->attr.save || sym->ns->save_all
+ if (sym->attr.save || sym->ns->save_all
|| (gfc_option.flag_max_stack_var_size == 0
&& (!sym->attr.dimension || !is_non_constant_shape_array (sym))))
{
return FAILURE;
}
}
-
+
return SUCCESS;
}
sym->attr.is_c_interop = 1;
sym->ts.is_c_interop = 1;
}
-
+
curr_arg = sym->formal;
while (curr_arg != NULL)
{
BIND(C) to try and prevent multiple errors being
reported. */
has_non_interop_arg = 1;
-
+
curr_arg = curr_arg->next;
}
sym->attr.is_bind_c = 0;
}
}
-
+
if (!sym->attr.proc_pointer)
{
if (sym->attr.save == SAVE_EXPLICIT)
{
gfc_error ("FINAL procedure '%s' declared at %L has the same"
" rank (%d) as '%s'",
- list->proc_sym->name, &list->where, my_rank,
+ list->proc_sym->name, &list->where, my_rank,
i->proc_sym->name);
goto error;
}
{
gfc_symbol* super_type;
gfc_tbp_generic* target;
-
+
/* If there's already an error here, do nothing (but don't fail again). */
if (p->error)
return SUCCESS;
me_arg->name, &where, resolve_bindings_derived->name);
goto error;
}
-
+
gcc_assert (me_arg->ts.type == BT_CLASS);
if (CLASS_DATA (me_arg)->as && CLASS_DATA (me_arg)->as->rank > 0)
{
if (!derived->f2k_derived || !derived->f2k_derived->tb_sym_root)
return SUCCESS;
-
+
super_type = gfc_get_derived_super_type (derived);
if (super_type)
resolve_typebound_procedures (super_type);
clearer than something sophisticated. */
gcc_assert (ancestor && !sub->attr.abstract);
-
+
if (!ancestor->attr.abstract)
return SUCCESS;
c->as = gfc_copy_array_spec (ifc->result->as);
}
else
- {
+ {
c->ts = ifc->ts;
c->attr.allocatable = ifc->attr.allocatable;
c->attr.pointer = ifc->attr.pointer;
|| (!sym->attr.is_class && c == sym->components))
&& strcmp (super_type->name, c->name) == 0)
c->attr.access = super_type->attr.access;
-
+
/* If this type is an extension, see if this component has the same name
as an inherited type-bound procedure. */
if (super_type && !sym->attr.is_class
vptr->ts.u.derived = vtab->ts.u.derived;
}
}
-
+
if (resolve_fl_derived0 (sym) == FAILURE)
return FAILURE;
-
+
/* Resolve the type-bound procedures. */
if (resolve_typebound_procedures (sym) == FAILURE)
return FAILURE;
/* Resolve the finalizer procedures. */
if (gfc_resolve_finalizers (sym) == FAILURE)
return FAILURE;
-
+
return SUCCESS;
}
resolve_fl_parameter (gfc_symbol *sym)
{
/* A parameter array's shape needs to be constant. */
- if (sym->as != NULL
+ if (sym->as != NULL
&& (sym->as->type == AS_DEFERRED
|| is_non_constant_shape_array (sym)))
{
can. */
mp_flag = (sym->result != NULL && sym->result != sym);
- /* Make sure that the intrinsic is consistent with its internal
- representation. This needs to be done before assigning a default
+ /* Make sure that the intrinsic is consistent with its internal
+ representation. This needs to be done before assigning a default
type to avoid spurious warnings. */
if (sym->attr.flavor != FL_MODULE && sym->attr.intrinsic
&& resolve_intrinsic (sym, &sym->declared_at) == FAILURE)
sym->attr.flavor != FL_PROCEDURE && sym->attr.flavor != FL_DERIVED)
{
gfc_try t = SUCCESS;
-
+
/* First, make sure the variable is declared at the
module-level scope (J3/04-007, Section 15.3). */
if (sym->ns->proc_name->attr.flavor != FL_MODULE &&
verify_bind_c_derived_type (sym->ts.u.derived);
t = FAILURE;
}
-
+
/* Verify the variable itself as C interoperable if it
is BIND(C). It is not possible for this to succeed if
the verify_bind_c_derived_type failed, so don't have to handle
sym = ns->proc_name;
if (sym == NULL)
return 0;
-
+
if (sym->attr.flavor == FL_PROCEDURE)
break;
}
}
-
+
return sym->attr.flavor == FL_PROCEDURE && sym->attr.implicit_pure
&& !sym->attr.pure;
}
}
-/* Resolve equivalence object.
+/* Resolve equivalence object.
An EQUIVALENCE object shall not be a dummy argument, a pointer, a target,
an allocatable array, an object of nonsequence derived type, an object of
sequence derived type containing a pointer at any level of component
/* Expression translation
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
- 2011, 2012
+ 2011, 2012, 2013
Free Software Foundation, Inc.
Contributed by Paul Brook <paul@nowt.org>
and Steven Bosscher <s.bosscher@student.tudelft.nl>
/* Takes a derived type expression and returns the address of a temporary
- class object of the 'declared' type. */
+ class object of the 'declared' type. */
static void
gfc_conv_derived_to_class (gfc_se *parmse, gfc_expr *e,
gfc_typespec class_ts)
/* Takes a scalarized class array expression and returns the
address of a temporary scalar class object of the 'declared'
- type.
+ type.
OOP-TODO: This could be improved by adding code that branched on
the dynamic type being the same as the declared type. In this case
- the original class expression can be passed directly. */
+ the original class expression can be passed directly. */
void
gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e,
gfc_typespec class_ts, bool elemental)
tmp = NULL_TREE;
if (class_ref == NULL
- && e->symtree && e->symtree->n.sym->ts.type == BT_CLASS)
+ && e->symtree && e->symtree->n.sym->ts.type == BT_CLASS)
tmp = e->symtree->n.sym->backend_decl;
else
{
tmp = gfc_build_memcpy_call (dst.expr, src.expr, memsz.expr);
}
gfc_add_expr_to_block (&block, tmp);
-
+
return gfc_finish_block (&block);
}
tmp = gfc_get_int_type (kind);
tmp = fold_convert (tmp, build_fold_indirect_ref_loc (input_location,
se->expr));
-
+
/* Test for a NULL value. */
tmp = build3_loc (input_location, COND_EXPR, TREE_TYPE (tmp), present,
tmp, fold_convert (TREE_TYPE (tmp), integer_one_node));
gfc_ref *r;
tree length;
- gcc_assert (e->expr_type == EXPR_VARIABLE
+ gcc_assert (e->expr_type == EXPR_VARIABLE
&& e->ts.type == BT_CHARACTER);
-
+
length = NULL; /* To silence compiler warning. */
if (is_subref_array (e) && e->ts.u.cl->length)
{
case EXPR_OP:
- flatten_array_ctors_without_strlen (e->value.op.op1);
- flatten_array_ctors_without_strlen (e->value.op.op2);
+ flatten_array_ctors_without_strlen (e->value.op.op1);
+ flatten_array_ctors_without_strlen (e->value.op.op2);
break;
case EXPR_COMPCALL:
se_expr = gfc_get_fake_result_decl (sym, parent_flag);
/* Similarly for alternate entry points. */
- else if (alternate_entry
+ else if (alternate_entry
&& (sym->ns->proc_name->backend_decl == current_function_decl
|| parent_flag))
{
/* Dereference the expression, where needed. Since characters
- are entirely different from other types, they are treated
+ are entirely different from other types, they are treated
separately. */
if (sym->ts.type == BT_CHARACTER)
{
se->expr = build_fold_indirect_ref_loc (input_location,
se->expr);
- /* Dereference non-character pointer variables.
+ /* Dereference non-character pointer variables.
These must be dummies, results, or scalars. */
if ((sym->attr.pointer || sym->attr.allocatable
|| gfc_is_associate_pointer (sym))
{
if (expr->ts.type == BT_CHARACTER && !gfc_is_proc_ptr_comp (expr, NULL))
gfc_conv_string_parameter (se);
- else
+ else
se->expr = gfc_build_addr_expr (NULL_TREE, se->expr);
}
}
124, 166, 125, 214, 126, 138, 127, 153, /* 248 - 255 */
};
-/* If n is larger than lookup table's max index, we use the "window
+/* If n is larger than lookup table's max index, we use the "window
method". */
#define POWI_WINDOW_SIZE 3
-/* Recursive function to expand the power operator. The temporary
+/* Recursive function to expand the power operator. The temporary
values are put in tmpvar. The function returns tmpvar[1] ** n. */
static tree
gfc_conv_powi (gfc_se * se, unsigned HOST_WIDE_INT n, tree * tmpvar)
/* There's no ABS for HOST_WIDE_INT, so here we go. It also takes care
of the asymmetric range of the integer type. */
n = (unsigned HOST_WIDE_INT) (m < 0 ? -m : m);
-
+
type = TREE_TYPE (lhs);
sgn = tree_int_cst_sgn (rhs);
case 4:
ikind = 0;
break;
-
+
case 8:
ikind = 1;
break;
case 4:
kind = 0;
break;
-
+
case 8:
kind = 1;
break;
default:
gcc_unreachable ();
}
-
+
switch (expr->value.op.op1->ts.type)
{
case BT_INTEGER:
case 0:
fndecl = builtin_decl_explicit (BUILT_IN_POWIF);
break;
-
+
case 1:
fndecl = builtin_decl_explicit (BUILT_IN_POWI);
break;
break;
case 3:
- /* Use the __builtin_powil() only if real(kind=16) is
+ /* Use the __builtin_powil() only if real(kind=16) is
actually the C long double type. */
if (!gfc_real16_is_float128)
fndecl = builtin_decl_explicit (BUILT_IN_POWIL);
}
}
- /* If we don't have a good builtin for this, go for the
+ /* If we don't have a good builtin for this, go for the
library function. */
if (!fndecl)
fndecl = gfor_fndecl_math_powi[kind][ikind].real;
(int)(*expr)->value.character.string[0]);
if ((*expr)->ts.kind != gfc_c_int_kind)
{
- /* The expr needs to be compatible with a C int. If the
+ /* The expr needs to be compatible with a C int. If the
conversion fails, then the 2 causes an ICE. */
ts.type = BT_INTEGER;
ts.kind = gfc_c_int_kind;
else if (!sym->attr.dimension || sym->attr.pointer || sym->attr.allocatable)
value = build_fold_indirect_ref_loc (input_location,
se->expr);
-
- /* For character(*), use the actual argument's descriptor. */
+
+ /* For character(*), use the actual argument's descriptor. */
else if (sym->ts.type == BT_CHARACTER && !new_sym->ts.u.cl->length)
value = build_fold_indirect_ref_loc (input_location,
se->expr);
rss = gfc_walk_expr (expr);
gcc_assert (rss != gfc_ss_terminator);
-
+
/* Initialize the scalarizer. */
gfc_init_loopinfo (&loop);
gfc_add_ss_to_loop (&loop, rss);
tmp = gfc_trans_scalar_assign (&lse, &rse, expr->ts, false, false, true);
gfc_add_expr_to_block (&body, tmp);
-
+
/* Generate the copying loops. */
gfc_trans_scalarizing_loops (&loop2, &body);
if (formal_ptr)
{
size = gfc_index_one_node;
- offset = gfc_index_zero_node;
+ offset = gfc_index_zero_node;
for (n = 0; n < dimen; n++)
{
tmp = gfc_conv_descriptor_ubound_get (parmse->expr,
{
gfc_symbol *fsym;
gfc_ss *argss;
-
+
if (sym->intmod_sym_id == ISOCBINDING_LOC)
{
if (arg->expr->rank == 0)
&& !(fsym->attr.pointer || fsym->attr.allocatable)
&& fsym->as->type != AS_ASSUMED_SHAPE;
f = f || !sym->attr.always_explicit;
-
+
argss = gfc_walk_expr (arg->expr);
gfc_conv_array_parameter (se, arg->expr, argss, f,
NULL, NULL, NULL);
arg->expr->ts.f90_type = sym->ts.u.derived->ts.f90_type;
arg->expr->ts.kind = sym->ts.u.derived->ts.kind;
gfc_conv_expr_reference (se, arg->expr);
-
+
return 1;
}
else if ((sym->intmod_sym_id == ISOCBINDING_F_POINTER
gfc_conv_expr (&fptrse, arg->next->expr);
gfc_add_block_to_block (&se->pre, &fptrse.pre);
gfc_add_block_to_block (&se->post, &fptrse.post);
-
+
if (arg->next->expr->symtree->n.sym->attr.proc_pointer
&& arg->next->expr->symtree->n.sym->attr.dummy)
fptrse.expr = build_fold_indirect_ref_loc (input_location,
fptrse.expr);
-
+
se->expr = fold_build2_loc (input_location, MODIFY_EXPR,
TREE_TYPE (fptrse.expr),
fptrse.expr,
{
tree eq_expr;
tree not_null_expr;
-
+
/* Given two arguments so build the arg2se from second arg. */
gfc_init_se (&arg2se, NULL);
gfc_conv_expr (&arg2se, arg->next->expr);
return 1;
}
-
+
/* Nothing was done. */
return 0;
}
parmse.expr = gfc_build_addr_expr (NULL_TREE, parmse.expr);
}
else
- gfc_conv_expr_reference (&parmse, e);
+ {
+ gfc_conv_expr_reference (&parmse, e);
+ if (e->ts.type == BT_CHARACTER && !e->rank
+ && e->expr_type == EXPR_FUNCTION)
+ parmse.expr = build_fold_indirect_ref_loc (input_location,
+ parmse.expr);
+ }
/* The scalarizer does not repackage the reference to a class
array - instead it returns a pointer to the data element. */
&& !CLASS_DATA (e)->attr.codimension)
parmse.expr = gfc_class_data_get (parmse.expr);
- /* If an ALLOCATABLE dummy argument has INTENT(OUT) and is
+ /* If an ALLOCATABLE dummy argument has INTENT(OUT) and is
allocated on entry, it must be deallocated. */
if (fsym && fsym->attr.allocatable
&& fsym->attr.intent == INTENT_OUT)
/* If the argument is a function call that may not create
a temporary for the result, we have to check that we
- can do it, i.e. that there is no alias between this
+ can do it, i.e. that there is no alias between this
argument and another one. */
if (gfc_get_noncopying_intrinsic_argument (e) != NULL)
{
gfc_conv_array_parameter (&parmse, e, argss, f, fsym,
sym->name, NULL);
- /* If an ALLOCATABLE dummy argument has INTENT(OUT) and is
+ /* If an ALLOCATABLE dummy argument has INTENT(OUT) and is
allocated on entry, it must be deallocated. */
if (fsym && fsym->attr.allocatable
&& fsym->attr.intent == INTENT_OUT)
tmp, build_empty_stmt (input_location));
gfc_add_expr_to_block (&se->pre, tmp);
}
- }
+ }
}
/* The case with fsym->attr.optional is that of a user subroutine
&& ((e->rank > 0 && sym->attr.elemental)
|| e->representation.length || e->ts.type == BT_CHARACTER
|| (e->rank > 0
- && (fsym == NULL
+ && (fsym == NULL
|| (fsym-> as
&& (fsym->as->type == AS_ASSUMED_SHAPE
|| fsym->as->type == AS_DEFERRED))))))
fold_convert (TREE_TYPE (tmp),
null_pointer_node));
}
-
+
gfc_trans_runtime_check (true, false, cond, &se->pre, &e->where,
msg);
free (msg);
&& GFC_TYPE_ARRAY_CAF_TOKEN (caf_type) != NULL_TREE);
tmp = GFC_TYPE_ARRAY_CAF_TOKEN (caf_type);
}
-
+
VEC_safe_push (tree, gc, stringargs, tmp);
if (GFC_DESCRIPTOR_TYPE_P (caf_type)
gfc_conv_expr (&parmse, ts.u.cl->length);
gfc_add_block_to_block (&se->pre, &parmse.pre);
gfc_add_block_to_block (&se->post, &parmse.post);
-
+
tmp = fold_convert (gfc_charlen_type_node, parmse.expr);
tmp = fold_build2_loc (input_location, MAX_EXPR,
gfc_charlen_type_node, tmp,
/* Build a static initializer. EXPR is the expression for the initial value.
- The other parameters describe the variable of the component being
+ The other parameters describe the variable of the component being
initialized. EXPR may be null. */
tree
gcc_assert (TREE_CODE (se.expr) != CONSTRUCTOR);
return se.expr;
}
-
+
if (array && !procptr)
{
tree ctor;
}
}
}
-
+
static tree
gfc_trans_subarray_assign (tree dest, gfc_component * cm, gfc_expr * expr)
{
cm->as->lower[n]->value.integer);
mpz_add_ui (lss_array->shape[n], lss_array->shape[n], 1);
}
-
+
/* Associate the SS with the loop. */
gfc_add_ss_to_loop (&loop, lss);
gfc_add_ss_to_loop (&loop, rss);
gfc_start_block (&block);
gfc_init_se (&se, NULL);
- /* Get the descriptor for the expressions. */
+ /* Get the descriptor for the expressions. */
rss = gfc_walk_expr (expr);
se.want_pointer = 0;
gfc_conv_expr_descriptor (&se, expr, rss);
fold_convert (TREE_TYPE (lse.expr), se.expr));
return gfc_finish_block (&block);
- }
+ }
for (c = gfc_constructor_first (expr->value.constructor);
c; c = gfc_constructor_next (c), cm = cm->next)
}
}
se->expr = build_constructor (type, v);
- if (init)
+ if (init)
TREE_CONSTANT (se->expr) = 1;
}
for (remap = expr1->ref; remap; remap = remap->next)
if (!remap->next && remap->type == REF_ARRAY
&& remap->u.ar.type == AR_SECTION)
- {
+ {
remap->u.ar.type = AR_FULL;
break;
}
else if (ts.type == BT_DERIVED && ts.u.derived->attr.alloc_comp)
{
cond = NULL_TREE;
-
+
/* Are the rhs and the lhs the same? */
if (r_is_var)
{
/* Functions returning pointers or allocatables need temporaries. */
c = expr2->value.function.esym
- ? (expr2->value.function.esym->attr.pointer
+ ? (expr2->value.function.esym->attr.pointer
|| expr2->value.function.esym->attr.allocatable)
: (expr2->symtree->n.sym->attr.pointer
|| expr2->symtree->n.sym->attr.allocatable);
correctly take care of the reallocation internally. For intrinsic
calls, the array data is freed and the library takes care of allocation.
TODO: Add logic of trans-array.c: gfc_alloc_allocatable_for_assignment
- to the library. */
+ to the library. */
if (gfc_option.flag_realloc_lhs
&& gfc_is_reallocatable_lhs (expr1)
&& !gfc_expr_attr (expr1).codimension
gfc_init_se (&lse, NULL);
lse.want_pointer = 1;
gfc_conv_expr (&lse, expr1);
-
+
jump_label1 = gfc_build_label_decl (NULL_TREE);
jump_label2 = gfc_build_label_decl (NULL_TREE);