Commit d168c883 by Jakub Jelinek Committed by Jakub Jelinek

trans-intrinsic.c (gfc_conv_intrinsic_minmax): Use VAR_P (x) instead of TREE_CODE (x) == VAR_DECL.

	* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Use VAR_P (x)
	instead of TREE_CODE (x) == VAR_DECL.
	* trans-expr.c (gfc_class_vptr_get, gfc_class_len_get,
	gfc_class_len_or_zero_get, gfc_get_vptr_from_expr,
	gfc_conv_string_length, conv_base_obj_fcn_val,
	gfc_conv_procedure_call, gfc_trans_assignment_1): Likewise.
	* trans-openmp.c (gfc_omp_predetermined_sharing,
	gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause,
	gfc_trans_omp_atomic, gfc_trans_omp_do): Likewise.
	* trans-io.c (nml_get_addr_expr): Likewise.
	* trans-decl.c (gfc_finish_decl, gfc_build_qualified_array,
	gfc_get_symbol_decl, gfc_get_fake_result_decl,
	gfc_trans_deferred_vars, gfc_trans_use_stmts,
	generate_local_decl): Likewise.
	* trans-array.c (trans_array_constructor, trans_array_bound_check,
	build_class_array_ref, gfc_array_init_size,
	gfc_trans_auto_array_allocation, gfc_trans_g77_array,
	gfc_trans_dummy_array_bias, gfc_alloc_allocatable_for_assignment,
	gfc_trans_deferred_array): Likewise.
	* trans.c (gfc_build_array_ref): Likewise.  Use
	VAR_OR_FUNCTION_DECL_P (x) instead of TREE_CODE (x) == VAR_DECL
	|| TREE_CODE (x) == FUNCTION_DECL.

From-SVN: r241482
parent 44670295
2016-10-24 Jakub Jelinek <jakub@redhat.com>
* trans-intrinsic.c (gfc_conv_intrinsic_minmax): Use VAR_P (x)
instead of TREE_CODE (x) == VAR_DECL.
* trans-expr.c (gfc_class_vptr_get, gfc_class_len_get,
gfc_class_len_or_zero_get, gfc_get_vptr_from_expr,
gfc_conv_string_length, conv_base_obj_fcn_val,
gfc_conv_procedure_call, gfc_trans_assignment_1): Likewise.
* trans-openmp.c (gfc_omp_predetermined_sharing,
gfc_omp_disregard_value_expr, gfc_omp_private_debug_clause,
gfc_trans_omp_atomic, gfc_trans_omp_do): Likewise.
* trans-io.c (nml_get_addr_expr): Likewise.
* trans-decl.c (gfc_finish_decl, gfc_build_qualified_array,
gfc_get_symbol_decl, gfc_get_fake_result_decl,
gfc_trans_deferred_vars, gfc_trans_use_stmts,
generate_local_decl): Likewise.
* trans-array.c (trans_array_constructor, trans_array_bound_check,
build_class_array_ref, gfc_array_init_size,
gfc_trans_auto_array_allocation, gfc_trans_g77_array,
gfc_trans_dummy_array_bias, gfc_alloc_allocatable_for_assignment,
gfc_trans_deferred_array): Likewise.
* trans.c (gfc_build_array_ref): Likewise. Use
VAR_OR_FUNCTION_DECL_P (x) instead of TREE_CODE (x) == VAR_DECL
|| TREE_CODE (x) == FUNCTION_DECL.
2016-10-23 Steven G. Kargl <kargl@gcc.gnu.org> 2016-10-23 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77763 PR fortran/77763
......
...@@ -2373,7 +2373,7 @@ trans_array_constructor (gfc_ss * ss, locus * where) ...@@ -2373,7 +2373,7 @@ trans_array_constructor (gfc_ss * ss, locus * where)
offsetvar, gfc_index_one_node); offsetvar, gfc_index_one_node);
tmp = gfc_evaluate_now (tmp, &outer_loop->pre); tmp = gfc_evaluate_now (tmp, &outer_loop->pre);
gfc_conv_descriptor_ubound_set (&loop->pre, desc, gfc_rank_cst[0], tmp); gfc_conv_descriptor_ubound_set (&loop->pre, desc, gfc_rank_cst[0], tmp);
if (*loop_ubound0 && TREE_CODE (*loop_ubound0) == VAR_DECL) if (*loop_ubound0 && VAR_P (*loop_ubound0))
gfc_add_modify (&outer_loop->pre, *loop_ubound0, tmp); gfc_add_modify (&outer_loop->pre, *loop_ubound0, tmp);
else else
*loop_ubound0 = tmp; *loop_ubound0 = tmp;
...@@ -2860,7 +2860,7 @@ trans_array_bound_check (gfc_se * se, gfc_ss *ss, tree index, int n, ...@@ -2860,7 +2860,7 @@ trans_array_bound_check (gfc_se * se, gfc_ss *ss, tree index, int n,
name = ss->info->expr->symtree->n.sym->name; name = ss->info->expr->symtree->n.sym->name;
gcc_assert (name != NULL); gcc_assert (name != NULL);
if (TREE_CODE (descriptor) == VAR_DECL) if (VAR_P (descriptor))
name = IDENTIFIER_POINTER (DECL_NAME (descriptor)); name = IDENTIFIER_POINTER (DECL_NAME (descriptor));
/* If upper bound is present, include both bounds in the error message. */ /* If upper bound is present, include both bounds in the error message. */
...@@ -3104,7 +3104,7 @@ build_class_array_ref (gfc_se *se, tree base, tree index) ...@@ -3104,7 +3104,7 @@ build_class_array_ref (gfc_se *se, tree base, tree index)
else else
type = NULL_TREE; type = NULL_TREE;
} }
if (TREE_CODE (tmp) == VAR_DECL) if (VAR_P (tmp))
break; break;
} }
...@@ -5096,8 +5096,9 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset, ...@@ -5096,8 +5096,9 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
/* Set the dtype before the alloc, because registration of coarrays needs /* Set the dtype before the alloc, because registration of coarrays needs
it initialized. */ it initialized. */
if (expr->ts.type == BT_CHARACTER && expr->ts.deferred if (expr->ts.type == BT_CHARACTER
&& TREE_CODE (expr->ts.u.cl->backend_decl) == VAR_DECL) && expr->ts.deferred
&& VAR_P (expr->ts.u.cl->backend_decl))
{ {
type = gfc_typenode_for_spec (&expr->ts); type = gfc_typenode_for_spec (&expr->ts);
tmp = gfc_conv_descriptor_dtype (descriptor); tmp = gfc_conv_descriptor_dtype (descriptor);
...@@ -5968,7 +5969,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, ...@@ -5968,7 +5969,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym,
/* Don't actually allocate space for Cray Pointees. */ /* Don't actually allocate space for Cray Pointees. */
if (sym->attr.cray_pointee) if (sym->attr.cray_pointee)
{ {
if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) if (VAR_P (GFC_TYPE_ARRAY_OFFSET (type)))
gfc_add_modify (&init, GFC_TYPE_ARRAY_OFFSET (type), offset); gfc_add_modify (&init, GFC_TYPE_ARRAY_OFFSET (type), offset);
gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE); gfc_add_init_cleanup (block, gfc_finish_block (&init), NULL_TREE);
...@@ -6001,7 +6002,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, ...@@ -6001,7 +6002,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym,
} }
/* Set offset of the array. */ /* Set offset of the array. */
if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) if (VAR_P (GFC_TYPE_ARRAY_OFFSET (type)))
gfc_add_modify (&init, GFC_TYPE_ARRAY_OFFSET (type), offset); gfc_add_modify (&init, GFC_TYPE_ARRAY_OFFSET (type), offset);
/* Automatic arrays should not have initializers. */ /* Automatic arrays should not have initializers. */
...@@ -6054,14 +6055,14 @@ gfc_trans_g77_array (gfc_symbol * sym, gfc_wrapped_block * block) ...@@ -6054,14 +6055,14 @@ gfc_trans_g77_array (gfc_symbol * sym, gfc_wrapped_block * block)
gfc_start_block (&init); gfc_start_block (&init);
if (sym->ts.type == BT_CHARACTER if (sym->ts.type == BT_CHARACTER
&& TREE_CODE (sym->ts.u.cl->backend_decl) == VAR_DECL) && VAR_P (sym->ts.u.cl->backend_decl))
gfc_conv_string_length (sym->ts.u.cl, NULL, &init); gfc_conv_string_length (sym->ts.u.cl, NULL, &init);
/* Evaluate the bounds of the array. */ /* Evaluate the bounds of the array. */
gfc_trans_array_bounds (type, sym, &offset, &init); gfc_trans_array_bounds (type, sym, &offset, &init);
/* Set the offset. */ /* Set the offset. */
if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) if (VAR_P (GFC_TYPE_ARRAY_OFFSET (type)))
gfc_add_modify (&init, GFC_TYPE_ARRAY_OFFSET (type), offset); gfc_add_modify (&init, GFC_TYPE_ARRAY_OFFSET (type), offset);
/* Set the pointer itself if we aren't using the parameter directly. */ /* Set the pointer itself if we aren't using the parameter directly. */
...@@ -6160,7 +6161,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, ...@@ -6160,7 +6161,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
gfc_start_block (&init); gfc_start_block (&init);
if (sym->ts.type == BT_CHARACTER if (sym->ts.type == BT_CHARACTER
&& TREE_CODE (sym->ts.u.cl->backend_decl) == VAR_DECL) && VAR_P (sym->ts.u.cl->backend_decl))
gfc_conv_string_length (sym->ts.u.cl, NULL, &init); gfc_conv_string_length (sym->ts.u.cl, NULL, &init);
checkparm = (as->type == AS_EXPLICIT checkparm = (as->type == AS_EXPLICIT
...@@ -6384,7 +6385,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, ...@@ -6384,7 +6385,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
gfc_trans_array_cobounds (type, &init, sym); gfc_trans_array_cobounds (type, &init, sym);
/* Set the offset. */ /* Set the offset. */
if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) if (VAR_P (GFC_TYPE_ARRAY_OFFSET (type)))
gfc_add_modify (&init, GFC_TYPE_ARRAY_OFFSET (type), offset); gfc_add_modify (&init, GFC_TYPE_ARRAY_OFFSET (type), offset);
gfc_trans_vla_type_sizes (sym, &init); gfc_trans_vla_type_sizes (sym, &init);
...@@ -8977,7 +8978,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, ...@@ -8977,7 +8978,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
tmp = gfc_conv_descriptor_offset (desc); tmp = gfc_conv_descriptor_offset (desc);
gfc_add_modify (&fblock, tmp, offset); gfc_add_modify (&fblock, tmp, offset);
if (linfo->saved_offset if (linfo->saved_offset
&& TREE_CODE (linfo->saved_offset) == VAR_DECL) && VAR_P (linfo->saved_offset))
gfc_add_modify (&fblock, linfo->saved_offset, tmp); gfc_add_modify (&fblock, linfo->saved_offset, tmp);
/* Now set the deltas for the lhs. */ /* Now set the deltas for the lhs. */
...@@ -8988,8 +8989,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, ...@@ -8988,8 +8989,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
tmp = fold_build2_loc (input_location, MINUS_EXPR, tmp = fold_build2_loc (input_location, MINUS_EXPR,
gfc_array_index_type, tmp, gfc_array_index_type, tmp,
loop->from[dim]); loop->from[dim]);
if (linfo->delta[dim] if (linfo->delta[dim] && VAR_P (linfo->delta[dim]))
&& TREE_CODE (linfo->delta[dim]) == VAR_DECL)
gfc_add_modify (&fblock, linfo->delta[dim], tmp); gfc_add_modify (&fblock, linfo->delta[dim], tmp);
} }
...@@ -8998,7 +8998,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, ...@@ -8998,7 +8998,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
{ {
if (expr2->ts.deferred) if (expr2->ts.deferred)
{ {
if (TREE_CODE (expr2->ts.u.cl->backend_decl) == VAR_DECL) if (VAR_P (expr2->ts.u.cl->backend_decl))
tmp = expr2->ts.u.cl->backend_decl; tmp = expr2->ts.u.cl->backend_decl;
else else
tmp = rss->info->string_length; tmp = rss->info->string_length;
...@@ -9016,7 +9016,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, ...@@ -9016,7 +9016,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
} }
if (expr1->ts.u.cl->backend_decl if (expr1->ts.u.cl->backend_decl
&& TREE_CODE (expr1->ts.u.cl->backend_decl) == VAR_DECL) && VAR_P (expr1->ts.u.cl->backend_decl))
gfc_add_modify (&fblock, expr1->ts.u.cl->backend_decl, tmp); gfc_add_modify (&fblock, expr1->ts.u.cl->backend_decl, tmp);
else else
gfc_add_modify (&fblock, lss->info->string_length, tmp); gfc_add_modify (&fblock, lss->info->string_length, tmp);
...@@ -9182,8 +9182,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, ...@@ -9182,8 +9182,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
gfc_add_expr_to_block (&fblock, tmp); gfc_add_expr_to_block (&fblock, tmp);
/* Make sure that the scalarizer data pointer is updated. */ /* Make sure that the scalarizer data pointer is updated. */
if (linfo->data if (linfo->data && VAR_P (linfo->data))
&& TREE_CODE (linfo->data) == VAR_DECL)
{ {
tmp = gfc_conv_descriptor_data_get (desc); tmp = gfc_conv_descriptor_data_get (desc);
gfc_add_modify (&fblock, linfo->data, tmp); gfc_add_modify (&fblock, linfo->data, tmp);
...@@ -9227,8 +9226,8 @@ gfc_trans_deferred_array (gfc_symbol * sym, gfc_wrapped_block * block) ...@@ -9227,8 +9226,8 @@ gfc_trans_deferred_array (gfc_symbol * sym, gfc_wrapped_block * block)
gfc_set_backend_locus (&sym->declared_at); gfc_set_backend_locus (&sym->declared_at);
gfc_init_block (&init); gfc_init_block (&init);
gcc_assert (TREE_CODE (sym->backend_decl) == VAR_DECL gcc_assert (VAR_P (sym->backend_decl)
|| TREE_CODE (sym->backend_decl) == PARM_DECL); || TREE_CODE (sym->backend_decl) == PARM_DECL);
if (sym->ts.type == BT_CHARACTER if (sym->ts.type == BT_CHARACTER
&& !INTEGER_CST_P (sym->ts.u.cl->backend_decl)) && !INTEGER_CST_P (sym->ts.u.cl->backend_decl))
......
...@@ -495,7 +495,7 @@ gfc_finish_decl (tree decl) ...@@ -495,7 +495,7 @@ gfc_finish_decl (tree decl)
gcc_assert (TREE_CODE (decl) == PARM_DECL gcc_assert (TREE_CODE (decl) == PARM_DECL
|| DECL_INITIAL (decl) == NULL_TREE); || DECL_INITIAL (decl) == NULL_TREE);
if (TREE_CODE (decl) != VAR_DECL) if (!VAR_P (decl))
return; return;
if (DECL_SIZE (decl) == NULL_TREE if (DECL_SIZE (decl) == NULL_TREE
...@@ -1020,7 +1020,7 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) ...@@ -1020,7 +1020,7 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
if (TYPE_NAME (type) != NULL_TREE if (TYPE_NAME (type) != NULL_TREE
&& GFC_TYPE_ARRAY_UBOUND (type, as->rank - 1) != NULL_TREE && GFC_TYPE_ARRAY_UBOUND (type, as->rank - 1) != NULL_TREE
&& TREE_CODE (GFC_TYPE_ARRAY_UBOUND (type, as->rank - 1)) == VAR_DECL) && VAR_P (GFC_TYPE_ARRAY_UBOUND (type, as->rank - 1)))
{ {
tree gtype = DECL_ORIGINAL_TYPE (TYPE_NAME (type)); tree gtype = DECL_ORIGINAL_TYPE (TYPE_NAME (type));
...@@ -1050,8 +1050,10 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) ...@@ -1050,8 +1050,10 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
can be tracked by VTA. Also set DECL_NAMELESS, so that can be tracked by VTA. Also set DECL_NAMELESS, so that
the artificial lbound.N or ubound.N DECL_NAME doesn't the artificial lbound.N or ubound.N DECL_NAME doesn't
end up in debug info. */ end up in debug info. */
if (lbound && TREE_CODE (lbound) == VAR_DECL if (lbound
&& DECL_ARTIFICIAL (lbound) && DECL_IGNORED_P (lbound)) && VAR_P (lbound)
&& DECL_ARTIFICIAL (lbound)
&& DECL_IGNORED_P (lbound))
{ {
if (DECL_NAME (lbound) if (DECL_NAME (lbound)
&& strstr (IDENTIFIER_POINTER (DECL_NAME (lbound)), && strstr (IDENTIFIER_POINTER (DECL_NAME (lbound)),
...@@ -1059,8 +1061,10 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym) ...@@ -1059,8 +1061,10 @@ gfc_build_qualified_array (tree decl, gfc_symbol * sym)
DECL_NAMELESS (lbound) = 1; DECL_NAMELESS (lbound) = 1;
DECL_IGNORED_P (lbound) = 0; DECL_IGNORED_P (lbound) = 0;
} }
if (ubound && TREE_CODE (ubound) == VAR_DECL if (ubound
&& DECL_ARTIFICIAL (ubound) && DECL_IGNORED_P (ubound)) && VAR_P (ubound)
&& DECL_ARTIFICIAL (ubound)
&& DECL_IGNORED_P (ubound))
{ {
if (DECL_NAME (ubound) if (DECL_NAME (ubound)
&& strstr (IDENTIFIER_POINTER (DECL_NAME (ubound)), && strstr (IDENTIFIER_POINTER (DECL_NAME (ubound)),
...@@ -1514,8 +1518,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) ...@@ -1514,8 +1518,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
length = gfc_create_string_length (sym); length = gfc_create_string_length (sym);
else else
length = sym->ts.u.cl->backend_decl; length = sym->ts.u.cl->backend_decl;
if (TREE_CODE (length) == VAR_DECL if (VAR_P (length) && DECL_FILE_SCOPE_P (length))
&& DECL_FILE_SCOPE_P (length))
{ {
/* Add the string length to the same context as the symbol. */ /* Add the string length to the same context as the symbol. */
if (DECL_CONTEXT (sym->backend_decl) == current_function_decl) if (DECL_CONTEXT (sym->backend_decl) == current_function_decl)
...@@ -1630,7 +1633,7 @@ gfc_get_symbol_decl (gfc_symbol * sym) ...@@ -1630,7 +1633,7 @@ gfc_get_symbol_decl (gfc_symbol * sym)
{ {
if (sym->attr.associate_var if (sym->attr.associate_var
&& sym->ts.u.cl->backend_decl && sym->ts.u.cl->backend_decl
&& TREE_CODE (sym->ts.u.cl->backend_decl) == VAR_DECL) && VAR_P (sym->ts.u.cl->backend_decl))
length = gfc_index_zero_node; length = gfc_index_zero_node;
else else
length = gfc_create_string_length (sym); length = gfc_create_string_length (sym);
...@@ -2924,8 +2927,7 @@ gfc_get_fake_result_decl (gfc_symbol * sym, int parent_flag) ...@@ -2924,8 +2927,7 @@ gfc_get_fake_result_decl (gfc_symbol * sym, int parent_flag)
length = gfc_create_string_length (sym); length = gfc_create_string_length (sym);
else else
length = sym->ts.u.cl->backend_decl; length = sym->ts.u.cl->backend_decl;
if (TREE_CODE (length) == VAR_DECL if (VAR_P (length) && DECL_CONTEXT (length) == NULL_TREE)
&& DECL_CONTEXT (length) == NULL_TREE)
gfc_add_decl_to_function (length); gfc_add_decl_to_function (length);
} }
...@@ -4123,7 +4125,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block) ...@@ -4123,7 +4125,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
/* An automatic character length, pointer array result. */ /* An automatic character length, pointer array result. */
if (proc_sym->ts.type == BT_CHARACTER if (proc_sym->ts.type == BT_CHARACTER
&& TREE_CODE (proc_sym->ts.u.cl->backend_decl) == VAR_DECL) && VAR_P (proc_sym->ts.u.cl->backend_decl))
{ {
tmp = NULL; tmp = NULL;
if (proc_sym->ts.deferred) if (proc_sym->ts.deferred)
...@@ -4176,7 +4178,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block) ...@@ -4176,7 +4178,7 @@ gfc_trans_deferred_vars (gfc_symbol * proc_sym, gfc_wrapped_block * block)
gfc_add_init_cleanup (block, gfc_finish_block (&init), tmp); gfc_add_init_cleanup (block, gfc_finish_block (&init), tmp);
} }
else if (TREE_CODE (proc_sym->ts.u.cl->backend_decl) == VAR_DECL) else if (VAR_P (proc_sym->ts.u.cl->backend_decl))
gfc_trans_dummy_character (proc_sym, proc_sym->ts.u.cl, block); gfc_trans_dummy_character (proc_sym, proc_sym->ts.u.cl, block);
} }
else else
...@@ -4843,8 +4845,7 @@ gfc_trans_use_stmts (gfc_namespace * ns) ...@@ -4843,8 +4845,7 @@ gfc_trans_use_stmts (gfc_namespace * ns)
&& strcmp (st->n.sym->module, use_stmt->module_name) == 0) && strcmp (st->n.sym->module, use_stmt->module_name) == 0)
{ {
gcc_assert (DECL_EXTERNAL (entry->namespace_decl) gcc_assert (DECL_EXTERNAL (entry->namespace_decl)
|| (TREE_CODE (st->n.sym->backend_decl) || !VAR_P (st->n.sym->backend_decl));
!= VAR_DECL));
decl = copy_node (st->n.sym->backend_decl); decl = copy_node (st->n.sym->backend_decl);
DECL_CONTEXT (decl) = entry->namespace_decl; DECL_CONTEXT (decl) = entry->namespace_decl;
DECL_EXTERNAL (decl) = 1; DECL_EXTERNAL (decl) = 1;
...@@ -5385,7 +5386,7 @@ generate_local_decl (gfc_symbol * sym) ...@@ -5385,7 +5386,7 @@ generate_local_decl (gfc_symbol * sym)
if (sym->attr.dummy && !sym->attr.referenced if (sym->attr.dummy && !sym->attr.referenced
&& sym->ts.type == BT_CHARACTER && sym->ts.type == BT_CHARACTER
&& sym->ts.u.cl->backend_decl != NULL && sym->ts.u.cl->backend_decl != NULL
&& TREE_CODE (sym->ts.u.cl->backend_decl) == VAR_DECL) && VAR_P (sym->ts.u.cl->backend_decl))
{ {
sym->attr.referenced = 1; sym->attr.referenced = 1;
gfc_get_symbol_decl (sym); gfc_get_symbol_decl (sym);
......
...@@ -198,7 +198,7 @@ gfc_class_vptr_get (tree decl) ...@@ -198,7 +198,7 @@ gfc_class_vptr_get (tree decl)
tree vptr; tree vptr;
/* For class arrays decl may be a temporary descriptor handle, the vptr is /* For class arrays decl may be a temporary descriptor handle, the vptr is
then available through the saved descriptor. */ then available through the saved descriptor. */
if (TREE_CODE (decl) == VAR_DECL && DECL_LANG_SPECIFIC (decl) if (VAR_P (decl) && DECL_LANG_SPECIFIC (decl)
&& GFC_DECL_SAVED_DESCRIPTOR (decl)) && GFC_DECL_SAVED_DESCRIPTOR (decl))
decl = GFC_DECL_SAVED_DESCRIPTOR (decl); decl = GFC_DECL_SAVED_DESCRIPTOR (decl);
if (POINTER_TYPE_P (TREE_TYPE (decl))) if (POINTER_TYPE_P (TREE_TYPE (decl)))
...@@ -217,7 +217,7 @@ gfc_class_len_get (tree decl) ...@@ -217,7 +217,7 @@ gfc_class_len_get (tree decl)
tree len; tree len;
/* For class arrays decl may be a temporary descriptor handle, the len is /* For class arrays decl may be a temporary descriptor handle, the len is
then available through the saved descriptor. */ then available through the saved descriptor. */
if (TREE_CODE (decl) == VAR_DECL && DECL_LANG_SPECIFIC (decl) if (VAR_P (decl) && DECL_LANG_SPECIFIC (decl)
&& GFC_DECL_SAVED_DESCRIPTOR (decl)) && GFC_DECL_SAVED_DESCRIPTOR (decl))
decl = GFC_DECL_SAVED_DESCRIPTOR (decl); decl = GFC_DECL_SAVED_DESCRIPTOR (decl);
if (POINTER_TYPE_P (TREE_TYPE (decl))) if (POINTER_TYPE_P (TREE_TYPE (decl)))
...@@ -239,7 +239,7 @@ gfc_class_len_or_zero_get (tree decl) ...@@ -239,7 +239,7 @@ gfc_class_len_or_zero_get (tree decl)
tree len; tree len;
/* For class arrays decl may be a temporary descriptor handle, the vptr is /* For class arrays decl may be a temporary descriptor handle, the vptr is
then available through the saved descriptor. */ then available through the saved descriptor. */
if (TREE_CODE (decl) == VAR_DECL && DECL_LANG_SPECIFIC (decl) if (VAR_P (decl) && DECL_LANG_SPECIFIC (decl)
&& GFC_DECL_SAVED_DESCRIPTOR (decl)) && GFC_DECL_SAVED_DESCRIPTOR (decl))
decl = GFC_DECL_SAVED_DESCRIPTOR (decl); decl = GFC_DECL_SAVED_DESCRIPTOR (decl);
if (POINTER_TYPE_P (TREE_TYPE (decl))) if (POINTER_TYPE_P (TREE_TYPE (decl)))
...@@ -485,8 +485,7 @@ gfc_get_vptr_from_expr (tree expr) ...@@ -485,8 +485,7 @@ gfc_get_vptr_from_expr (tree expr)
else else
type = NULL_TREE; type = NULL_TREE;
} }
if (TREE_CODE (tmp) == VAR_DECL if (VAR_P (tmp) || TREE_CODE (tmp) == PARM_DECL)
|| TREE_CODE (tmp) == PARM_DECL)
break; break;
} }
...@@ -2160,9 +2159,7 @@ gfc_conv_string_length (gfc_charlen * cl, gfc_expr * expr, stmtblock_t * pblock) ...@@ -2160,9 +2159,7 @@ gfc_conv_string_length (gfc_charlen * cl, gfc_expr * expr, stmtblock_t * pblock)
gfc_init_se (&se, NULL); gfc_init_se (&se, NULL);
if (!cl->length if (!cl->length && cl->backend_decl && VAR_P (cl->backend_decl))
&& cl->backend_decl
&& TREE_CODE (cl->backend_decl) == VAR_DECL)
return; return;
/* If cl->length is NULL, use gfc_conv_expr to obtain the string length but /* If cl->length is NULL, use gfc_conv_expr to obtain the string length but
...@@ -3664,7 +3661,7 @@ conv_base_obj_fcn_val (gfc_se * se, tree base_object, gfc_expr * expr) ...@@ -3664,7 +3661,7 @@ conv_base_obj_fcn_val (gfc_se * se, tree base_object, gfc_expr * expr)
gfc_ref *ref; gfc_ref *ref;
tree var; tree var;
if (TREE_CODE (base_object) != VAR_DECL) if (!VAR_P (base_object))
{ {
var = gfc_create_var (TREE_TYPE (base_object), NULL); var = gfc_create_var (TREE_TYPE (base_object), NULL);
gfc_add_modify (&se->pre, var, base_object); gfc_add_modify (&se->pre, var, base_object);
...@@ -5675,8 +5672,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, ...@@ -5675,8 +5672,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
else else
{ {
tmp = parmse.string_length; tmp = parmse.string_length;
if (TREE_CODE (tmp) != VAR_DECL if (!VAR_P (tmp) && TREE_CODE (tmp) != COMPONENT_REF)
&& TREE_CODE (tmp) != COMPONENT_REF)
tmp = gfc_evaluate_now (parmse.string_length, &se->pre); tmp = gfc_evaluate_now (parmse.string_length, &se->pre);
parmse.string_length = gfc_build_addr_expr (NULL_TREE, tmp); parmse.string_length = gfc_build_addr_expr (NULL_TREE, tmp);
} }
...@@ -6019,7 +6015,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, ...@@ -6019,7 +6015,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
if (ts.type == BT_CHARACTER && ts.deferred) if (ts.type == BT_CHARACTER && ts.deferred)
{ {
tmp = len; tmp = len;
if (TREE_CODE (tmp) != VAR_DECL) if (!VAR_P (tmp))
tmp = gfc_evaluate_now (len, &se->pre); tmp = gfc_evaluate_now (len, &se->pre);
TREE_STATIC (tmp) = 1; TREE_STATIC (tmp) = 1;
gfc_add_modify (&se->pre, tmp, gfc_add_modify (&se->pre, tmp,
...@@ -9692,7 +9688,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag, ...@@ -9692,7 +9688,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
/* Stabilize a string length for temporaries. */ /* Stabilize a string length for temporaries. */
if (expr2->ts.type == BT_CHARACTER && !expr1->ts.deferred if (expr2->ts.type == BT_CHARACTER && !expr1->ts.deferred
&& !(TREE_CODE (rse.string_length) == VAR_DECL && !(VAR_P (rse.string_length)
|| TREE_CODE (rse.string_length) == PARM_DECL || TREE_CODE (rse.string_length) == PARM_DECL
|| TREE_CODE (rse.string_length) == INDIRECT_REF)) || TREE_CODE (rse.string_length) == INDIRECT_REF))
string_length = gfc_evaluate_now (rse.string_length, &rse.pre); string_length = gfc_evaluate_now (rse.string_length, &rse.pre);
......
...@@ -3653,7 +3653,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, enum tree_code op) ...@@ -3653,7 +3653,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, enum tree_code op)
if (TREE_TYPE (args[0]) != type) if (TREE_TYPE (args[0]) != type)
args[0] = convert (type, args[0]); args[0] = convert (type, args[0]);
/* Only evaluate the argument once. */ /* Only evaluate the argument once. */
if (TREE_CODE (args[0]) != VAR_DECL && !TREE_CONSTANT (args[0])) if (!VAR_P (args[0]) && !TREE_CONSTANT (args[0]))
args[0] = gfc_evaluate_now (args[0], &se->pre); args[0] = gfc_evaluate_now (args[0], &se->pre);
mvar = gfc_create_var (type, "M"); mvar = gfc_create_var (type, "M");
...@@ -3677,7 +3677,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, enum tree_code op) ...@@ -3677,7 +3677,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, enum tree_code op)
cond = NULL_TREE; cond = NULL_TREE;
/* Only evaluate the argument once. */ /* Only evaluate the argument once. */
if (TREE_CODE (val) != VAR_DECL && !TREE_CONSTANT (val)) if (!VAR_P (val) && !TREE_CONSTANT (val))
val = gfc_evaluate_now (val, &se->pre); val = gfc_evaluate_now (val, &se->pre);
} }
......
...@@ -1573,10 +1573,10 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c, ...@@ -1573,10 +1573,10 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c,
else else
decl = c->backend_decl; decl = c->backend_decl;
gcc_assert (decl && ((TREE_CODE (decl) == FIELD_DECL gcc_assert (decl && (TREE_CODE (decl) == FIELD_DECL
|| TREE_CODE (decl) == VAR_DECL || VAR_P (decl)
|| TREE_CODE (decl) == PARM_DECL) || TREE_CODE (decl) == PARM_DECL
|| TREE_CODE (decl) == COMPONENT_REF)); || TREE_CODE (decl) == COMPONENT_REF));
tmp = decl; tmp = decl;
......
...@@ -143,9 +143,7 @@ gfc_omp_predetermined_sharing (tree decl) ...@@ -143,9 +143,7 @@ gfc_omp_predetermined_sharing (tree decl)
variables at all (they can't be redefined), but they can nevertheless appear variables at all (they can't be redefined), but they can nevertheless appear
in parallel/task regions and for default(none) purposes treat them as shared. in parallel/task regions and for default(none) purposes treat them as shared.
For vtables likely the same handling is desirable. */ For vtables likely the same handling is desirable. */
if (TREE_CODE (decl) == VAR_DECL if (VAR_P (decl) && TREE_READONLY (decl) && TREE_STATIC (decl))
&& TREE_READONLY (decl)
&& TREE_STATIC (decl))
return OMP_CLAUSE_DEFAULT_SHARED; return OMP_CLAUSE_DEFAULT_SHARED;
return OMP_CLAUSE_DEFAULT_UNSPECIFIED; return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
...@@ -1156,7 +1154,7 @@ gfc_omp_disregard_value_expr (tree decl, bool shared) ...@@ -1156,7 +1154,7 @@ gfc_omp_disregard_value_expr (tree decl, bool shared)
tree value = DECL_VALUE_EXPR (decl); tree value = DECL_VALUE_EXPR (decl);
if (TREE_CODE (value) == COMPONENT_REF if (TREE_CODE (value) == COMPONENT_REF
&& TREE_CODE (TREE_OPERAND (value, 0)) == VAR_DECL && VAR_P (TREE_OPERAND (value, 0))
&& GFC_DECL_COMMON_OR_EQUIV (TREE_OPERAND (value, 0))) && GFC_DECL_COMMON_OR_EQUIV (TREE_OPERAND (value, 0)))
{ {
/* If variable in COMMON or EQUIVALENCE is privatized, return /* If variable in COMMON or EQUIVALENCE is privatized, return
...@@ -1192,7 +1190,7 @@ gfc_omp_private_debug_clause (tree decl, bool shared) ...@@ -1192,7 +1190,7 @@ gfc_omp_private_debug_clause (tree decl, bool shared)
tree value = DECL_VALUE_EXPR (decl); tree value = DECL_VALUE_EXPR (decl);
if (TREE_CODE (value) == COMPONENT_REF if (TREE_CODE (value) == COMPONENT_REF
&& TREE_CODE (TREE_OPERAND (value, 0)) == VAR_DECL && VAR_P (TREE_OPERAND (value, 0))
&& GFC_DECL_COMMON_OR_EQUIV (TREE_OPERAND (value, 0))) && GFC_DECL_COMMON_OR_EQUIV (TREE_OPERAND (value, 0)))
return shared; return shared;
} }
...@@ -3001,7 +2999,7 @@ gfc_trans_omp_atomic (gfc_code *code) ...@@ -3001,7 +2999,7 @@ gfc_trans_omp_atomic (gfc_code *code)
lhsaddr = save_expr (lhsaddr); lhsaddr = save_expr (lhsaddr);
if (TREE_CODE (lhsaddr) != SAVE_EXPR if (TREE_CODE (lhsaddr) != SAVE_EXPR
&& (TREE_CODE (lhsaddr) != ADDR_EXPR && (TREE_CODE (lhsaddr) != ADDR_EXPR
|| TREE_CODE (TREE_OPERAND (lhsaddr, 0)) != VAR_DECL)) || !VAR_P (TREE_OPERAND (lhsaddr, 0))))
{ {
/* Make sure LHS is simple enough so that goa_lhs_expr_p can recognize /* Make sure LHS is simple enough so that goa_lhs_expr_p can recognize
it even after unsharing function body. */ it even after unsharing function body. */
...@@ -3233,7 +3231,7 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock, ...@@ -3233,7 +3231,7 @@ gfc_trans_omp_do (gfc_code *code, gfc_exec_op op, stmtblock_t *pblock,
dovar_decl = dovar; dovar_decl = dovar;
/* Special case simple loops. */ /* Special case simple loops. */
if (TREE_CODE (dovar) == VAR_DECL) if (VAR_P (dovar))
{ {
if (integer_onep (step)) if (integer_onep (step))
simple = 1; simple = 1;
......
...@@ -335,7 +335,7 @@ gfc_build_array_ref (tree base, tree offset, tree decl, tree vptr) ...@@ -335,7 +335,7 @@ gfc_build_array_ref (tree base, tree offset, tree decl, tree vptr)
references. */ references. */
if (type && TREE_CODE (type) == ARRAY_TYPE if (type && TREE_CODE (type) == ARRAY_TYPE
&& TYPE_MAXVAL (TYPE_DOMAIN (type)) != NULL_TREE && TYPE_MAXVAL (TYPE_DOMAIN (type)) != NULL_TREE
&& (TREE_CODE (TYPE_MAXVAL (TYPE_DOMAIN (type))) == VAR_DECL && (VAR_P (TYPE_MAXVAL (TYPE_DOMAIN (type)))
|| TREE_CODE (TYPE_MAXVAL (TYPE_DOMAIN (type))) == INDIRECT_REF) || TREE_CODE (TYPE_MAXVAL (TYPE_DOMAIN (type))) == INDIRECT_REF)
&& decl && decl
&& (TREE_CODE (TYPE_MAXVAL (TYPE_DOMAIN (type))) == INDIRECT_REF && (TREE_CODE (TYPE_MAXVAL (TYPE_DOMAIN (type))) == INDIRECT_REF
...@@ -356,9 +356,8 @@ gfc_build_array_ref (tree base, tree offset, tree decl, tree vptr) ...@@ -356,9 +356,8 @@ gfc_build_array_ref (tree base, tree offset, tree decl, tree vptr)
subreference, use the span that is stored with the backend decl subreference, use the span that is stored with the backend decl
and reference the element with pointer arithmetic. */ and reference the element with pointer arithmetic. */
if ((decl && (TREE_CODE (decl) == FIELD_DECL if ((decl && (TREE_CODE (decl) == FIELD_DECL
|| TREE_CODE (decl) == VAR_DECL || VAR_OR_FUNCTION_DECL_P (decl)
|| TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == PARM_DECL)
|| TREE_CODE (decl) == FUNCTION_DECL)
&& ((GFC_DECL_SUBREF_ARRAY_P (decl) && ((GFC_DECL_SUBREF_ARRAY_P (decl)
&& !integer_zerop (GFC_DECL_SPAN (decl))) && !integer_zerop (GFC_DECL_SPAN (decl)))
|| GFC_DECL_CLASS (decl) || GFC_DECL_CLASS (decl)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment