aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.c
diff options
context:
space:
mode:
authorJanne Blomqvist <jb@gcc.gnu.org>2017-11-08 13:51:00 +0200
committerJanne Blomqvist <jb@gcc.gnu.org>2017-11-08 13:51:00 +0200
commit63ee540430c32a4f93924f4b2d970999b7cd201b (patch)
tree490c0d79ce827b128def2d2dcfe98a59d0a21aa6 /gcc/fortran/trans-array.c
parentc8ce479d39e94b4b7898776efcbbbd81505c57e9 (diff)
downloadgcc-63ee540430c32a4f93924f4b2d970999b7cd201b.zip
gcc-63ee540430c32a4f93924f4b2d970999b7cd201b.tar.gz
gcc-63ee540430c32a4f93924f4b2d970999b7cd201b.tar.bz2
PR 82869 Introduce logical_type_node and use it
Earlier GFortran used to redefine boolean_type_node, which in the rest of the compiler means the C/C++ _Bool/bool type, to the Fortran default logical type. When this redefinition was removed, a few issues surfaced. Namely, 1) PR 82869, where we created a boolean tmp variable, and passed it to the runtime library as a Fortran logical variable of a different size. 2) Fortran specifies that logical operations should be done with the default logical kind, not in any other kind. 3) Using 8-bit variables have some issues, such as - on x86, partial register stalls and length prefix changes. - s390 has a compare with immediate and jump instruction which works with 32-bit but not 8-bit quantities. This patch addresses these issues by introducing a type logical_type_node which is a Fortran LOGICAL variable of default kind. It is then used in places were the Fortran standard mandates, as well as for compiler generated temporary variables. For x86-64, using the Polyhedron benchmark suite, no performance or code size difference worth mentioning was observed. Regtested on x86_64-pc-linux-gnu. gcc/fortran/ChangeLog: 2017-11-08 Janne Blomqvist <jb@gcc.gnu.org> PR 82869 * convert.c (truthvalue_conversion): Use logical_type_node. * trans-array.c (gfc_trans_allocate_array_storage): Likewise. (gfc_trans_create_temp_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (trans_array_constructor): Likewise. (trans_array_bound_check): Likewise. (gfc_conv_array_ref): Likewise. (gfc_trans_scalarized_loop_end): Likewise. (gfc_conv_array_extent_dim): Likewise. (gfc_array_init_size): Likewise. (gfc_array_allocate): Likewise. (gfc_trans_array_bounds): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (duplicate_allocatable): Likewise. (duplicate_allocatable_coarray): Likewise. (structure_alloc_comps): Likewise (get_std_lbound): Likewise (gfc_alloc_allocatable_for_assignment): Likewise * trans-decl.c (add_argument_checking): Likewise (gfc_generate_function_code): Likewise * trans-expr.c (gfc_copy_class_to_class): Likewise (gfc_trans_class_array_init_assign): Likewise (gfc_trans_class_init_assign): Likewise (gfc_conv_expr_present): Likewise (gfc_conv_substring): Likewise (gfc_conv_cst_int_power): Likewise (gfc_conv_expr_op): Likewise (gfc_conv_procedure_call): Likewise (fill_with_spaces): Likewise (gfc_trans_string_copy): Likewise (gfc_trans_alloc_subarray_assign): Likewise (gfc_trans_pointer_assignment): Likewise (gfc_trans_scalar_assign): Likewise (fcncall_realloc_result): Likewise (alloc_scalar_allocatable_for_assignment): Likewise (trans_class_assignment): Likewise (gfc_trans_assignment_1): Likewise * trans-intrinsic.c (build_fixbound_expr): Likewise (gfc_conv_intrinsic_aint): Likewise (gfc_trans_same_strlen_check): Likewise (conv_caf_send): Likewise (trans_this_image): Likewise (conv_intrinsic_image_status): Likewise (trans_image_index): Likewise (gfc_conv_intrinsic_bound): Likewise (conv_intrinsic_cobound): Likewise (gfc_conv_intrinsic_mod): Likewise (gfc_conv_intrinsic_dshift): Likewise (gfc_conv_intrinsic_dim): Likewise (gfc_conv_intrinsic_sign): Likewise (gfc_conv_intrinsic_ctime): Likewise (gfc_conv_intrinsic_fdate): Likewise (gfc_conv_intrinsic_ttynam): Likewise (gfc_conv_intrinsic_minmax): Likewise (gfc_conv_intrinsic_minmax_char): Likewise (gfc_conv_intrinsic_anyall): Likewise (gfc_conv_intrinsic_arith): Likewise (gfc_conv_intrinsic_minmaxloc): Likewise (gfc_conv_intrinsic_minmaxval): Likewise (gfc_conv_intrinsic_btest): Likewise (gfc_conv_intrinsic_bitcomp): Likewise (gfc_conv_intrinsic_shift): Likewise (gfc_conv_intrinsic_ishft): Likewise (gfc_conv_intrinsic_ishftc): Likewise (gfc_conv_intrinsic_leadz): Likewise (gfc_conv_intrinsic_trailz): Likewise (gfc_conv_intrinsic_mask): Likewise (gfc_conv_intrinsic_spacing): Likewise (gfc_conv_intrinsic_rrspacing): Likewise (gfc_conv_intrinsic_size): Likewise (gfc_conv_intrinsic_sizeof): Likewise (gfc_conv_intrinsic_transfer): Likewise (gfc_conv_allocated): Likewise (gfc_conv_associated): Likewise (gfc_conv_same_type_as): Likewise (gfc_conv_intrinsic_trim): Likewise (gfc_conv_intrinsic_repeat): Likewise (conv_isocbinding_function): Likewise (conv_intrinsic_ieee_is_normal): Likewise (conv_intrinsic_ieee_is_negative): Likewise (conv_intrinsic_ieee_copy_sign): Likewise (conv_intrinsic_move_alloc): Likewise * trans-io.c (set_parameter_value_chk): Likewise (set_parameter_value_inquire): Likewise (set_string): Likewise * trans-openmp.c (gfc_walk_alloc_comps): Likewise (gfc_omp_clause_default_ctor): Likewise (gfc_omp_clause_copy_ctor): Likewise (gfc_omp_clause_assign_op): Likewise (gfc_omp_clause_dtor): Likewise (gfc_omp_finish_clause): Likewise (gfc_trans_omp_clauses): Likewise (gfc_trans_omp_do): Likewise * trans-stmt.c (gfc_trans_goto): Likewise (gfc_trans_sync): Likewise (gfc_trans_arithmetic_if): Likewise (gfc_trans_simple_do): Likewise (gfc_trans_do): Likewise (gfc_trans_forall_loop): Likewise (gfc_trans_where_2): Likewise (gfc_trans_allocate): Likewise (gfc_trans_deallocate): Likewise * trans-types.c (gfc_init_types): Initialize logical_type_node and its true/false trees. (gfc_get_array_descr_info): Use logical_type_node. * trans-types.h (logical_type_node): New tree. (logical_true_node): Likewise. (logical_false_node): Likewise. * trans.c (gfc_trans_runtime_check): Use logical_type_node. (gfc_call_malloc): Likewise (gfc_allocate_using_malloc): Likewise (gfc_allocate_allocatable): Likewise (gfc_add_comp_finalizer_call): Likewise (gfc_add_finalizer_call): Likewise (gfc_deallocate_with_status): Likewise (gfc_deallocate_scalar_with_status): Likewise (gfc_call_realloc): Likewise gcc/testsuite/ChangeLog: 2017-11-08 Janne Blomqvist <jb@gcc.gnu.org> PR 82869 * gfortran.dg/logical_temp_io.f90: New test. * gfortran.dg/logical_temp_io_kind8.f90: New test. From-SVN: r254526
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r--gcc/fortran/trans-array.c150
1 files changed, 75 insertions, 75 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c
index 59b09fa..93ce68e 100644
--- a/gcc/fortran/trans-array.c
+++ b/gcc/fortran/trans-array.c
@@ -1034,7 +1034,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post,
gfc_add_expr_to_block (&do_copying, tmp);
was_packed = fold_build2_loc (input_location, EQ_EXPR,
- boolean_type_node, packed,
+ logical_type_node, packed,
source_data);
tmp = gfc_finish_block (&do_copying);
tmp = build3_v (COND_EXPR, was_packed, tmp,
@@ -1302,7 +1302,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss,
to[n], gfc_index_one_node);
/* Check whether the size for this dimension is negative. */
- cond = fold_build2_loc (input_location, LE_EXPR, boolean_type_node,
+ cond = fold_build2_loc (input_location, LE_EXPR, logical_type_node,
tmp, gfc_index_zero_node);
cond = gfc_evaluate_now (cond, pre);
@@ -1310,7 +1310,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, gfc_ss * ss,
or_expr = cond;
else
or_expr = fold_build2_loc (input_location, TRUTH_OR_EXPR,
- boolean_type_node, or_expr, cond);
+ logical_type_node, or_expr, cond);
size = fold_build2_loc (input_location, MULT_EXPR,
gfc_array_index_type, size, tmp);
@@ -1570,7 +1570,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc,
/* Verify that all constructor elements are of the same
length. */
tree cond = fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node, first_len_val,
+ logical_type_node, first_len_val,
se->string_length);
gfc_trans_runtime_check
(true, false, cond, &se->pre, &expr->where,
@@ -1912,14 +1912,14 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type,
/* Generate the exit condition. Depending on the sign of
the step variable we have to generate the correct
comparison. */
- tmp = fold_build2_loc (input_location, GT_EXPR, boolean_type_node,
+ tmp = fold_build2_loc (input_location, GT_EXPR, logical_type_node,
step, build_int_cst (TREE_TYPE (step), 0));
cond = fold_build3_loc (input_location, COND_EXPR,
- boolean_type_node, tmp,
+ logical_type_node, tmp,
fold_build2_loc (input_location, GT_EXPR,
- boolean_type_node, shadow_loopvar, end),
+ logical_type_node, shadow_loopvar, end),
fold_build2_loc (input_location, LT_EXPR,
- boolean_type_node, shadow_loopvar, end));
+ logical_type_node, shadow_loopvar, end));
tmp = build1_v (GOTO_EXPR, exit_label);
TREE_USED (exit_label) = 1;
tmp = build3_v (COND_EXPR, cond, tmp,
@@ -2427,7 +2427,7 @@ trans_array_constructor (gfc_ss * ss, locus * where)
/* Check if the character length is negative. If it is, then
set LEN = 0. */
neg_len = fold_build2_loc (input_location, LT_EXPR,
- boolean_type_node, ss_info->string_length,
+ logical_type_node, ss_info->string_length,
build_int_cst (gfc_charlen_type_node, 0));
/* Print a warning if bounds checking is enabled. */
if (gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)
@@ -3065,13 +3065,13 @@ trans_array_bound_check (gfc_se * se, gfc_ss *ss, tree index, int n,
msg = xasprintf ("Index '%%ld' of dimension %d "
"outside of expected range (%%ld:%%ld)", n+1);
- fault = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
+ fault = fold_build2_loc (input_location, LT_EXPR, logical_type_node,
index, tmp_lo);
gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
fold_convert (long_integer_type_node, index),
fold_convert (long_integer_type_node, tmp_lo),
fold_convert (long_integer_type_node, tmp_up));
- fault = fold_build2_loc (input_location, GT_EXPR, boolean_type_node,
+ fault = fold_build2_loc (input_location, GT_EXPR, logical_type_node,
index, tmp_up);
gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
fold_convert (long_integer_type_node, index),
@@ -3090,7 +3090,7 @@ trans_array_bound_check (gfc_se * se, gfc_ss *ss, tree index, int n,
msg = xasprintf ("Index '%%ld' of dimension %d "
"below lower bound of %%ld", n+1);
- fault = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
+ fault = fold_build2_loc (input_location, LT_EXPR, logical_type_node,
index, tmp_lo);
gfc_trans_runtime_check (true, false, fault, &se->pre, where, msg,
fold_convert (long_integer_type_node, index),
@@ -3597,7 +3597,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr,
tmp = tmpse.expr;
}
- cond = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
+ cond = fold_build2_loc (input_location, LT_EXPR, logical_type_node,
indexse.expr, tmp);
msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
"below lower bound of %%ld", n+1, var_name);
@@ -3622,7 +3622,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_expr *expr,
}
cond = fold_build2_loc (input_location, GT_EXPR,
- boolean_type_node, indexse.expr, tmp);
+ logical_type_node, indexse.expr, tmp);
msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
"above upper bound of %%ld", n+1, var_name);
gfc_trans_runtime_check (true, false, cond, &se->pre, where, msg,
@@ -3890,7 +3890,7 @@ gfc_trans_scalarized_loop_end (gfc_loopinfo * loop, int n,
OMP_FOR_INIT (stmt) = init;
/* The exit condition. */
TREE_VEC_ELT (cond, 0) = build2_loc (input_location, LE_EXPR,
- boolean_type_node,
+ logical_type_node,
loop->loopvar[n], loop->to[n]);
SET_EXPR_LOCATION (TREE_VEC_ELT (cond, 0), input_location);
OMP_FOR_COND (stmt) = cond;
@@ -3925,7 +3925,7 @@ gfc_trans_scalarized_loop_end (gfc_loopinfo * loop, int n,
/* The exit condition. */
cond = fold_build2_loc (input_location, reverse_loop ? LT_EXPR : GT_EXPR,
- boolean_type_node, loop->loopvar[n], loop->to[n]);
+ logical_type_node, loop->loopvar[n], loop->to[n]);
tmp = build1_v (GOTO_EXPR, exit_label);
TREE_USED (exit_label) = 1;
tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt (input_location));
@@ -4357,7 +4357,7 @@ done:
check_upper = true;
/* Zero stride is not allowed. */
- tmp = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node,
+ tmp = fold_build2_loc (input_location, EQ_EXPR, logical_type_node,
info->stride[dim], gfc_index_zero_node);
msg = xasprintf ("Zero stride is not allowed, for dimension %d "
"of array '%s'", dim + 1, expr_name);
@@ -4380,23 +4380,23 @@ done:
/* non_zerosized is true when the selected range is not
empty. */
stride_pos = fold_build2_loc (input_location, GT_EXPR,
- boolean_type_node, info->stride[dim],
+ logical_type_node, info->stride[dim],
gfc_index_zero_node);
- tmp = fold_build2_loc (input_location, LE_EXPR, boolean_type_node,
+ tmp = fold_build2_loc (input_location, LE_EXPR, logical_type_node,
info->start[dim], end);
stride_pos = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node, stride_pos, tmp);
+ logical_type_node, stride_pos, tmp);
stride_neg = fold_build2_loc (input_location, LT_EXPR,
- boolean_type_node,
+ logical_type_node,
info->stride[dim], gfc_index_zero_node);
- tmp = fold_build2_loc (input_location, GE_EXPR, boolean_type_node,
+ tmp = fold_build2_loc (input_location, GE_EXPR, logical_type_node,
info->start[dim], end);
stride_neg = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node,
+ logical_type_node,
stride_neg, tmp);
non_zerosized = fold_build2_loc (input_location, TRUTH_OR_EXPR,
- boolean_type_node,
+ logical_type_node,
stride_pos, stride_neg);
/* Check the start of the range against the lower and upper
@@ -4406,16 +4406,16 @@ done:
if (check_upper)
{
tmp = fold_build2_loc (input_location, LT_EXPR,
- boolean_type_node,
+ logical_type_node,
info->start[dim], lbound);
tmp = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node,
+ logical_type_node,
non_zerosized, tmp);
tmp2 = fold_build2_loc (input_location, GT_EXPR,
- boolean_type_node,
+ logical_type_node,
info->start[dim], ubound);
tmp2 = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node,
+ logical_type_node,
non_zerosized, tmp2);
msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
"outside of expected range (%%ld:%%ld)",
@@ -4435,10 +4435,10 @@ done:
else
{
tmp = fold_build2_loc (input_location, LT_EXPR,
- boolean_type_node,
+ logical_type_node,
info->start[dim], lbound);
tmp = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node, non_zerosized, tmp);
+ logical_type_node, non_zerosized, tmp);
msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
"below lower bound of %%ld",
dim + 1, expr_name);
@@ -4462,15 +4462,15 @@ done:
tmp = fold_build2_loc (input_location, MINUS_EXPR,
gfc_array_index_type, end, tmp);
tmp2 = fold_build2_loc (input_location, LT_EXPR,
- boolean_type_node, tmp, lbound);
+ logical_type_node, tmp, lbound);
tmp2 = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node, non_zerosized, tmp2);
+ logical_type_node, non_zerosized, tmp2);
if (check_upper)
{
tmp3 = fold_build2_loc (input_location, GT_EXPR,
- boolean_type_node, tmp, ubound);
+ logical_type_node, tmp, ubound);
tmp3 = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node, non_zerosized, tmp3);
+ logical_type_node, non_zerosized, tmp3);
msg = xasprintf ("Index '%%ld' of dimension %d of array '%s' "
"outside of expected range (%%ld:%%ld)",
dim + 1, expr_name);
@@ -4516,7 +4516,7 @@ done:
if (size[n])
{
tmp3 = fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node, tmp, size[n]);
+ logical_type_node, tmp, size[n]);
msg = xasprintf ("Array bound mismatch for dimension %d "
"of array '%s' (%%ld/%%ld)",
dim + 1, expr_name);
@@ -5203,7 +5203,7 @@ gfc_conv_array_extent_dim (tree lbound, tree ubound, tree* or_expr)
gfc_index_one_node);
/* Check whether the size for this dimension is negative. */
- cond = fold_build2_loc (input_location, LE_EXPR, boolean_type_node, res,
+ cond = fold_build2_loc (input_location, LE_EXPR, logical_type_node, res,
gfc_index_zero_node);
res = fold_build3_loc (input_location, COND_EXPR, gfc_array_index_type, cond,
gfc_index_zero_node, res);
@@ -5211,7 +5211,7 @@ gfc_conv_array_extent_dim (tree lbound, tree ubound, tree* or_expr)
/* Build OR expression. */
if (or_expr)
*or_expr = fold_build2_loc (input_location, TRUTH_OR_EXPR,
- boolean_type_node, *or_expr, cond);
+ logical_type_node, *or_expr, cond);
return res;
}
@@ -5340,7 +5340,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
gfc_add_modify (pblock, tmp, gfc_get_dtype (type));
}
- or_expr = boolean_false_node;
+ or_expr = logical_false_node;
for (n = 0; n < rank; n++)
{
@@ -5448,12 +5448,12 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
TYPE_MAX_VALUE (gfc_array_index_type)),
size);
cond = gfc_unlikely (fold_build2_loc (input_location, LT_EXPR,
- boolean_type_node, tmp, stride),
+ logical_type_node, tmp, stride),
PRED_FORTRAN_OVERFLOW);
tmp = fold_build3_loc (input_location, COND_EXPR, integer_type_node, cond,
integer_one_node, integer_zero_node);
cond = gfc_unlikely (fold_build2_loc (input_location, EQ_EXPR,
- boolean_type_node, size,
+ logical_type_node, size,
gfc_index_zero_node),
PRED_FORTRAN_SIZE_ZERO);
tmp = fold_build3_loc (input_location, COND_EXPR, integer_type_node, cond,
@@ -5549,12 +5549,12 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset,
size_type_node,
TYPE_MAX_VALUE (size_type_node), element_size);
cond = gfc_unlikely (fold_build2_loc (input_location, LT_EXPR,
- boolean_type_node, tmp, stride),
+ logical_type_node, tmp, stride),
PRED_FORTRAN_OVERFLOW);
tmp = fold_build3_loc (input_location, COND_EXPR, integer_type_node, cond,
integer_one_node, integer_zero_node);
cond = gfc_unlikely (fold_build2_loc (input_location, EQ_EXPR,
- boolean_type_node, element_size,
+ logical_type_node, element_size,
build_int_cst (size_type_node, 0)),
PRED_FORTRAN_SIZE_ZERO);
tmp = fold_build3_loc (input_location, COND_EXPR, integer_type_node, cond,
@@ -5812,7 +5812,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
if (dimension)
{
cond = gfc_unlikely (fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node, var_overflow, integer_zero_node),
+ logical_type_node, var_overflow, integer_zero_node),
PRED_FORTRAN_OVERFLOW);
tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node, cond,
error, gfc_finish_block (&elseblock));
@@ -5843,7 +5843,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg,
if (status != NULL_TREE)
{
cond = fold_build2_loc (input_location, EQ_EXPR,
- boolean_type_node, status,
+ logical_type_node, status,
build_int_cst (TREE_TYPE (status), 0));
gfc_add_expr_to_block (&se->pre,
fold_build3_loc (input_location, COND_EXPR, void_type_node,
@@ -6093,7 +6093,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset,
/* Make sure that negative size arrays are translated
to being zero size. */
- tmp = fold_build2_loc (input_location, GE_EXPR, boolean_type_node,
+ tmp = fold_build2_loc (input_location, GE_EXPR, logical_type_node,
stride, gfc_index_zero_node);
tmp = fold_build3_loc (input_location, COND_EXPR,
gfc_array_index_type, tmp,
@@ -6380,10 +6380,10 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
/* For non-constant shape arrays we only check if the first dimension
is contiguous. Repacking higher dimensions wouldn't gain us
anything as we still don't know the array stride. */
- partial = gfc_create_var (boolean_type_node, "partial");
+ partial = gfc_create_var (logical_type_node, "partial");
TREE_USED (partial) = 1;
tmp = gfc_conv_descriptor_stride_get (dumdesc, gfc_rank_cst[0]);
- tmp = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node, tmp,
+ tmp = fold_build2_loc (input_location, EQ_EXPR, logical_type_node, tmp,
gfc_index_one_node);
gfc_add_modify (&init, partial, tmp);
}
@@ -6398,7 +6398,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
stride = gfc_conv_descriptor_stride_get (dumdesc, gfc_rank_cst[0]);
stride = gfc_evaluate_now (stride, &init);
- tmp = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node,
+ tmp = fold_build2_loc (input_location, EQ_EXPR, logical_type_node,
stride, gfc_index_zero_node);
tmp = fold_build3_loc (input_location, COND_EXPR, gfc_array_index_type,
tmp, gfc_index_one_node, stride);
@@ -6639,7 +6639,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc,
else
tmp = build_fold_indirect_ref_loc (input_location, dumdesc);
tmp = gfc_conv_descriptor_data_get (tmp);
- tmp = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ tmp = fold_build2_loc (input_location, NE_EXPR, logical_type_node,
tmp, tmpdesc);
stmtCleanup = build3_v (COND_EXPR, tmp, stmtCleanup,
build_empty_stmt (input_location));
@@ -7922,12 +7922,12 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
tmp = build_fold_indirect_ref_loc (input_location,
desc);
tmp = gfc_conv_array_data (tmp);
- tmp = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ tmp = fold_build2_loc (input_location, NE_EXPR, logical_type_node,
fold_convert (TREE_TYPE (tmp), ptr), tmp);
if (fsym && fsym->attr.optional && sym && sym->attr.optional)
tmp = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node,
+ logical_type_node,
gfc_conv_expr_present (sym), tmp);
gfc_trans_runtime_check (false, true, tmp, &se->pre,
@@ -7957,12 +7957,12 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77,
tmp = build_fold_indirect_ref_loc (input_location,
desc);
tmp = gfc_conv_array_data (tmp);
- tmp = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ tmp = fold_build2_loc (input_location, NE_EXPR, logical_type_node,
fold_convert (TREE_TYPE (tmp), ptr), tmp);
if (fsym && fsym->attr.optional && sym && sym->attr.optional)
tmp = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node,
+ logical_type_node,
gfc_conv_expr_present (sym), tmp);
tmp = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt (input_location));
@@ -8101,7 +8101,7 @@ duplicate_allocatable (tree dest, tree src, tree type, int rank,
null_cond = gfc_conv_descriptor_data_get (src);
null_cond = convert (pvoid_type_node, null_cond);
- null_cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ null_cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node,
null_cond, null_pointer_node);
return build3_v (COND_EXPR, null_cond, tmp, null_data);
}
@@ -8235,7 +8235,7 @@ duplicate_allocatable_coarray (tree dest, tree dest_tok, tree src,
null_cond = gfc_conv_descriptor_data_get (src);
null_cond = convert (pvoid_type_node, null_cond);
- null_cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ null_cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node,
null_cond, null_pointer_node);
gfc_add_expr_to_block (&globalblock, build3_v (COND_EXPR, null_cond, tmp,
null_data));
@@ -8350,7 +8350,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
null_cond = gfc_conv_descriptor_data_get (decl);
null_cond = fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node, null_cond,
+ logical_type_node, null_cond,
build_int_cst (TREE_TYPE (null_cond), 0));
}
else
@@ -8601,7 +8601,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
dealloc_fndecl);
tmp = build_int_cst (TREE_TYPE (comp), 0);
is_allocated = fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node, tmp,
+ logical_type_node, tmp,
comp);
cdesc = gfc_build_addr_expr (NULL_TREE, cdesc);
@@ -8881,7 +8881,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
null_data = gfc_finish_block (&tmpblock);
null_cond = fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node, src_data,
+ logical_type_node, src_data,
null_pointer_node);
gfc_add_expr_to_block (&fnblock, build3_v (COND_EXPR, null_cond,
@@ -9143,7 +9143,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
{
tmp = gfc_conv_descriptor_data_get (comp);
null_cond = fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node, tmp,
+ logical_type_node, tmp,
build_int_cst (TREE_TYPE (tmp), 0));
tmp = gfc_call_free (tmp);
tmp = build3_v (COND_EXPR, null_cond, tmp,
@@ -9154,7 +9154,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
else if (c->attr.pdt_string)
{
null_cond = fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node, comp,
+ logical_type_node, comp,
build_int_cst (TREE_TYPE (comp), 0));
tmp = gfc_call_free (comp);
tmp = build3_v (COND_EXPR, null_cond, tmp,
@@ -9201,7 +9201,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl,
tree error, cond, cname;
gfc_conv_expr_type (&tse, c_expr, TREE_TYPE (comp));
cond = fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node,
+ logical_type_node,
comp, tse.expr);
cname = gfc_build_cstring_const (c->name);
cname = gfc_build_addr_expr (pchar_type_node, cname);
@@ -9361,25 +9361,25 @@ get_std_lbound (gfc_expr *expr, tree desc, int dim, bool assumed_size)
lbound = gfc_conv_descriptor_lbound_get (desc, tmp);
ubound = gfc_conv_descriptor_ubound_get (desc, tmp);
stride = gfc_conv_descriptor_stride_get (desc, tmp);
- cond1 = fold_build2_loc (input_location, GE_EXPR, boolean_type_node,
+ cond1 = fold_build2_loc (input_location, GE_EXPR, logical_type_node,
ubound, lbound);
- cond3 = fold_build2_loc (input_location, GE_EXPR, boolean_type_node,
+ cond3 = fold_build2_loc (input_location, GE_EXPR, logical_type_node,
stride, gfc_index_zero_node);
cond3 = fold_build2_loc (input_location, TRUTH_AND_EXPR,
- boolean_type_node, cond3, cond1);
- cond4 = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
+ logical_type_node, cond3, cond1);
+ cond4 = fold_build2_loc (input_location, LT_EXPR, logical_type_node,
stride, gfc_index_zero_node);
if (assumed_size)
- cond = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node,
+ cond = fold_build2_loc (input_location, EQ_EXPR, logical_type_node,
tmp, build_int_cst (gfc_array_index_type,
expr->rank - 1));
else
- cond = boolean_false_node;
+ cond = logical_false_node;
cond1 = fold_build2_loc (input_location, TRUTH_OR_EXPR,
- boolean_type_node, cond3, cond4);
+ logical_type_node, cond3, cond4);
cond = fold_build2_loc (input_location, TRUTH_OR_EXPR,
- boolean_type_node, cond, cond1);
+ logical_type_node, cond, cond1);
return fold_build3_loc (input_location, COND_EXPR,
gfc_array_index_type, cond,
@@ -9632,11 +9632,11 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
jump_label2 = gfc_build_label_decl (NULL_TREE);
/* Allocate if data is NULL. */
- cond_null = fold_build2_loc (input_location, EQ_EXPR, boolean_type_node,
+ cond_null = fold_build2_loc (input_location, EQ_EXPR, logical_type_node,
array1, build_int_cst (TREE_TYPE (array1), 0));
if (expr1->ts.deferred)
- cond_null = gfc_evaluate_now (boolean_true_node, &fblock);
+ cond_null = gfc_evaluate_now (logical_true_node, &fblock);
else
cond_null= gfc_evaluate_now (cond_null, &fblock);
@@ -9676,7 +9676,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
gfc_array_index_type,
tmp, ubound);
cond = fold_build2_loc (input_location, NE_EXPR,
- boolean_type_node,
+ logical_type_node,
tmp, gfc_index_zero_node);
tmp = build3_v (COND_EXPR, cond,
build1_v (GOTO_EXPR, jump_label1),
@@ -9726,13 +9726,13 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
}
size2 = gfc_evaluate_now (size2, &fblock);
- cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
+ cond = fold_build2_loc (input_location, NE_EXPR, logical_type_node,
size1, size2);
/* If the lhs is deferred length, assume that the element size
changes and force a reallocation. */
if (expr1->ts.deferred)
- neq_size = gfc_evaluate_now (boolean_true_node, &fblock);
+ neq_size = gfc_evaluate_now (logical_true_node, &fblock);
else
neq_size = gfc_evaluate_now (cond, &fblock);
@@ -10012,7 +10012,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop,
/* Malloc if not allocated; realloc otherwise. */
tmp = build_int_cst (TREE_TYPE (array1), 0);
cond = fold_build2_loc (input_location, EQ_EXPR,
- boolean_type_node,
+ logical_type_node,
array1, tmp);
tmp = build3_v (COND_EXPR, cond, alloc_expr, realloc_expr);
gfc_add_expr_to_block (&fblock, tmp);