[PATCH] fortran: Convert build_int_cst (NULL_TREE, cst). [PR126622]
Kael Andrew Franco
kaelfandrew@gmail.com
Mon Sep 7 18:16:10 GMT 2026
https://gcc.gnu.org/pipermail/gcc-patches/2026-September/730258.html
did not work on ARM bootstrap. Please ignore this patch.
On Mon, Sep 7, 2026 at 9:55 AM Kael Andrew Alonzo Franco
<kaelfandrew@gmail.com> wrote:
>
> build_int_cst converts NULL_TREE to integer_type_node.
> Use build_int_cst (integer_type_node, cst) to prepare a patch
> to remove build_int_cst_type. trans_this_image is changed
> to prevent a testsuite failure.
>
> Bootstrapped and regtested on x86_64-pc-linux-gnu.
>
> PR middle-end/126622
>
> gcc/fortran/ChangeLog:
>
> * trans-intrinsic.cc (trans_this_image):
> Prevent testsuite failure.
> (conv_intrinsic_atomic_op): Use
> build_int_cst (integer_type_node, cst).
> (conv_intrinsic_atomic_cas): Ditto.
>
> Signed-off-by: Kael Andrew Franco <kaelfandrew@gmail.com>
> ---
> gcc/fortran/trans-intrinsic.cc | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/gcc/fortran/trans-intrinsic.cc b/gcc/fortran/trans-intrinsic.cc
> index 20516640656..4fb8e5a6cec 100644
> --- a/gcc/fortran/trans-intrinsic.cc
> +++ b/gcc/fortran/trans-intrinsic.cc
> @@ -1951,7 +1951,9 @@ trans_this_image (gfc_se * se, gfc_expr *expr)
> {
> /* sub(1) = m + lcobound(corank). */
> lbound = gfc_conv_descriptor_lbound_get (desc,
> - build_int_cst (TREE_TYPE (gfc_array_index_type),
> + build_int_cst (TREE_TYPE (gfc_array_index_type) ?
> + TREE_TYPE (gfc_array_index_type) :
> + integer_type_node,
> corank+rank-1));
> lbound = fold_convert (type, lbound);
> tmp = fold_build2_loc (input_location, PLUS_EXPR, type, tmp, lbound);
> @@ -12841,13 +12843,13 @@ conv_intrinsic_atomic_op (gfc_code *code)
> case GFC_ISYM_ATOMIC_XOR:
> tmp = build_call_expr_loc (input_location, tmp, 3, atom,
> fold_convert (itype, value),
> - build_int_cst (NULL, MEMMODEL_RELAXED));
> + build_int_cst (integer_type_node, MEMMODEL_RELAXED));
> gfc_add_expr_to_block (&block, tmp);
> break;
> default:
> tmp = build_call_expr_loc (input_location, tmp, 3, atom,
> fold_convert (itype, value),
> - build_int_cst (NULL, MEMMODEL_RELAXED));
> + build_int_cst (integer_type_node, MEMMODEL_RELAXED));
> gfc_add_modify (&block, old, fold_convert (TREE_TYPE (old), tmp));
> break;
> }
> @@ -13078,8 +13080,8 @@ conv_intrinsic_atomic_cas (gfc_code *code)
> gfc_build_addr_expr (NULL, old),
> fold_convert (TREE_TYPE (old), new_val),
> boolean_false_node,
> - build_int_cst (NULL, MEMMODEL_RELAXED),
> - build_int_cst (NULL, MEMMODEL_RELAXED));
> + build_int_cst (integer_type_node, MEMMODEL_RELAXED),
> + build_int_cst (integer_type_node, MEMMODEL_RELAXED));
> gfc_add_expr_to_block (&block, tmp);
>
> if (stat != NULL_TREE)
> --
> 2.55.0
>
More information about the Fortran
mailing list