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. omp_declare_variant_finalize_one
is changed to prevent g++.dg/gomp/append-args-{3,4,5}.C failures.

Bootstrapped and regtested on x86_64-pc-linux-gnu.

        PR middle-end/126622

gcc/ada/ChangeLog:

        * gcc-interface/utils.cc (DEF_ATTR_INT): Use
        build_int_cst (integer_type_node, cst).
        * gcc-interface/utils2.cc (expand_sloc): Ditto.
        * gcc-interface/trans.cc (Attribute_to_gnu): Ditto.
        (gnat_gimplify_stmt): Ditto.

gcc/c/ChangeLog:

        * c-parser.cc (c_parser_omp_for_loop): Use
        build_int_cst (integer_type_node, cst).

gcc/ChangeLog:

        * config/alpha/alpha.cc (alpha_va_start): Use
        build_int_cst (integer_type_node, cst).
        * config/i386/i386-options.cc (ix86_handle_tm_regparm_attribute): Ditto.
        * config/mips/mips.cc (mips_build_builtin_va_list): Ditto.
        (mips_gimplify_va_arg_expr): Ditto.
        * config/rs6000/rs6000-call.cc (rs6000_va_start): Ditto.
        * config/rs6000/rs6000-c.cc (altivec_build_resolved_builtin): Ditto.
        (resolve_vec_step): Ditto.
        * config/s390/s390.cc (s390_va_start): Ditto.
        * config/s390/s390-c.cc (s390_expand_overloaded_builtin): Ditto.
        (s390_resolve_overloaded_builtin): Ditto.
        * config/stormy16/stormy16.cc (xstormy16_expand_builtin_va_start): 
Ditto.
        * gimple-lower-bitint.cc (bitint_large_huge::handle_cast): Ditto.
        * omp-simd-clone.cc (simd_clone_adjust): Ditto.
        * trans-mem.cc (ipa_tm_insert_irr_call): Ditto.
        * tree-data-ref.cc (compute_overlap_steps_for_affine_univar): Ditto.
        (analyze_subscript_affine_affine): Ditto.
        * tsan.cc (instrument_builtin_call): Ditto.
        * omp-expand.cc (expand_omp_atomic_fetch_op): Ditto.
        (expand_omp_atomic_cas): Ditto.
        (expand_omp_atomic_pipeline): Ditto.
        * tree-vect-generic.cc (add_shift): Ditto.
        * tree-vect-patterns.cc (vect_recog_divmod_pattern): Ditto.
        * expr.cc (maybe_optimize_mod_cmp): Ditto.
        * gimple-ssa-store-merging.cc (bswap_replace): Ditto.
        (imm_store_chain_info::output_merged_store): Ditto.
        * omp-low.cc (lower_omp_ordered): Ditto.

gcc/cp/ChangeLog:

        * parser.cc (cp_parser_handle_statement_omp_attributes): Use
        build_int_cst (integer_type_node, cst).
        (cp_parser_omp_for_loop): Ditto.
        (cp_parser_late_parsing_omp_declare_simd): Ditto.
        (cp_maybe_parse_omp_decl): Ditto.
        (cp_parser_omp_metadirective): Ditto.
        * class.cc (finish_struct_1): Ditto.
        (build_vtbl_initializer): Ditto.
        * rtti.cc (build_headof): Ditto.
        (get_tinfo_ptr_dynamic): Ditto.
        (ptr_initializer): Ditto.
        (ptm_initializer): Ditto.
        (get_pseudo_ti_init0): Ditto.
        * cp-tree.h (SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT): Ditto.
        * decl.cc (cxx_init_decl_processing): Ditto.
        (omp_declare_variant_finalize_one): Prevent testsuite
        failures.

gcc/d/ChangeLog:

        * d-builtins.cc (DEF_ATTR_INT): Use
        build_int_cst (integer_type_node, cst).

gcc/lto/ChangeLog:

        * lto-lang.cc (DEF_ATTR_INT): Use
        build_int_cst (integer_type_node, cst).

gcc/objc/ChangeLog:

        * objc-act.cc (objc_finish_foreach_loop): Use
        build_int_cst (integer_type_node, cst).
        * objc-gnu-runtime-abi-01.cc 
(gnu_runtime_abi_01_build_const_string_constructor):
        Ditto.
        (generate_protocol_list): Ditto.
        (generate_v1_meth_descriptor_table): Ditto.
        (build_shared_structure_initializer): Ditto.
        (generate_ivars_list): Ditto.
        (get_proto_encoding): Ditto.
        * objc-next-runtime-abi-01.cc (next_runtime_01_initialize): Ditto.
        (next_runtime_abi_01_build_const_string_constructor): Ditto.
        (generate_v1_meth_descriptor_table): Ditto.
        (build_v1_category_initializer): Ditto.
        (build_next_objc_exception_stuff): Ditto.
        * objc-next-runtime-abi-02.cc 
(next_runtime_abi_02_build_const_string_constructor): Ditto.
        (generate_v2_meth_descriptor_table): Ditto.
        (generate_v2_protocols): Ditto.
        * objc-runtime-shared-support.cc (build_ivar_list_initializer): Ditto.

Signed-off-by: Kael Andrew Franco <[email protected]>
---
 gcc/ada/gcc-interface/trans.cc          |  4 ++--
 gcc/ada/gcc-interface/utils.cc          |  2 +-
 gcc/ada/gcc-interface/utils2.cc         |  4 ++--
 gcc/c/c-parser.cc                       |  2 +-
 gcc/config/alpha/alpha.cc               |  2 +-
 gcc/config/i386/i386-options.cc         |  2 +-
 gcc/config/mips/mips.cc                 |  6 +++---
 gcc/config/rs6000/rs6000-c.cc           |  4 ++--
 gcc/config/rs6000/rs6000-call.cc        |  4 ++--
 gcc/config/s390/s390-c.cc               |  4 ++--
 gcc/config/s390/s390.cc                 |  4 ++--
 gcc/config/stormy16/stormy16.cc         |  4 ++--
 gcc/cp/class.cc                         |  4 ++--
 gcc/cp/cp-tree.h                        |  2 +-
 gcc/cp/decl.cc                          |  6 +++---
 gcc/cp/parser.cc                        | 12 ++++++------
 gcc/cp/rtti.cc                          | 12 ++++++------
 gcc/d/d-builtins.cc                     |  2 +-
 gcc/expr.cc                             |  2 +-
 gcc/gimple-lower-bitint.cc              | 12 ++++++------
 gcc/gimple-ssa-store-merging.cc         |  6 +++---
 gcc/lto/lto-lang.cc                     |  2 +-
 gcc/objc/objc-act.cc                    | 10 +++++-----
 gcc/objc/objc-gnu-runtime-abi-01.cc     | 18 +++++++++---------
 gcc/objc/objc-next-runtime-abi-01.cc    | 10 +++++-----
 gcc/objc/objc-next-runtime-abi-02.cc    |  8 ++++----
 gcc/objc/objc-runtime-shared-support.cc |  2 +-
 gcc/omp-expand.cc                       | 12 ++++++------
 gcc/omp-low.cc                          |  4 ++--
 gcc/omp-simd-clone.cc                   |  2 +-
 gcc/trans-mem.cc                        |  2 +-
 gcc/tree-data-ref.cc                    | 14 +++++++-------
 gcc/tree-vect-generic.cc                |  2 +-
 gcc/tree-vect-patterns.cc               |  2 +-
 gcc/tsan.cc                             |  8 ++++----
 35 files changed, 98 insertions(+), 98 deletions(-)

diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index 995da1942e7..0c2d8685de1 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -1837,7 +1837,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree 
*gnu_result_type_p,
              if (build_descriptor)
                {
                  t = build2 (FDESC_EXPR, TREE_TYPE (gnu_field), gnu_prefix,
-                             build_int_cst (NULL_TREE, i));
+                             build_int_cst (integer_type_node, i));
                  TREE_CONSTANT (t) = 1;
                }
              else
@@ -9522,7 +9522,7 @@ gnat_gimplify_stmt (tree *stmt_p)
              gnu_cond = build3 (ANNOTATE_EXPR, TREE_TYPE (gnu_cond), gnu_cond,
                                 build_int_cst (integer_type_node,
                                                annot_expr_unroll_kind),
-                                build_int_cst (NULL_TREE, USHRT_MAX));
+                                build_int_cst (integer_type_node, USHRT_MAX));
            if (LOOP_STMT_NO_VECTOR (stmt))
              gnu_cond = build3 (ANNOTATE_EXPR, TREE_TYPE (gnu_cond), gnu_cond,
                                 build_int_cst (integer_type_node,
diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index f74b6361b40..b411265abc0 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -6887,7 +6887,7 @@ install_builtin_attributes (void)
 #define DEF_ATTR_NULL_TREE(ENUM)                               \
   built_in_attributes[(int) ENUM] = NULL_TREE;
 #define DEF_ATTR_INT(ENUM, VALUE)                              \
-  built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
+  built_in_attributes[(int) ENUM] = build_int_cst (integer_type_node, VALUE);
 #define DEF_ATTR_STRING(ENUM, VALUE)                           \
   built_in_attributes[(int) ENUM] = build_string (strlen (VALUE), VALUE);
 #define DEF_ATTR_IDENT(ENUM, STRING)                           \
diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc
index 9de47a70240..143174bed7c 100644
--- a/gcc/ada/gcc-interface/utils2.cc
+++ b/gcc/ada/gcc-interface/utils2.cc
@@ -2044,9 +2044,9 @@ expand_sloc (Node_Id gnat_node, tree *filename, tree 
*line, tree *col)
   *filename = build_string (len, str);
   TREE_TYPE (*filename) = build_array_type (char_type_node,
                                            build_index_type (size_int (len)));
-  *line = build_int_cst (NULL_TREE, line_number);
+  *line = build_int_cst (integer_type_node, line_number);
   if (col)
-    *col = build_int_cst (NULL_TREE, column_number);
+    *col = build_int_cst (integer_type_node, column_number);
 }
 
 /* Build a call to a function that raises an exception and passes file name
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 9dc5ba1e3a1..3c7572b17b9 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -25592,7 +25592,7 @@ c_parser_omp_for_loop (location_t loc, c_parser 
*parser, enum tree_code code,
       error_at (OMP_CLAUSE_LOCATION (ordered_cl),
                "%<ordered%> clause parameter is less than %<collapse%>");
       OMP_CLAUSE_ORDERED_EXPR (ordered_cl)
-       = build_int_cst (NULL_TREE, collapse);
+       = build_int_cst (integer_type_node, collapse);
       ordered = collapse;
     }
 
diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc
index e80844ed853..f70eebc8f18 100644
--- a/gcc/config/alpha/alpha.cc
+++ b/gcc/config/alpha/alpha.cc
@@ -6924,7 +6924,7 @@ alpha_va_start (tree valist, rtx nextarg ATTRIBUTE_UNUSED)
       TREE_SIDE_EFFECTS (t) = 1;
       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
 
-      t = build_int_cst (NULL_TREE, NUM_ARGS * UNITS_PER_WORD);
+      t = build_int_cst (integer_type_node, NUM_ARGS * UNITS_PER_WORD);
       t = build2 (MODIFY_EXPR, TREE_TYPE (offset_field), offset_field, t);
       TREE_SIDE_EFFECTS (t) = 1;
       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc
index 37bb75a75c2..ebd86f71f93 100644
--- a/gcc/config/i386/i386-options.cc
+++ b/gcc/config/i386/i386-options.cc
@@ -3818,7 +3818,7 @@ ix86_handle_tm_regparm_attribute (tree *node, tree, tree,
     alt = tree_cons (get_identifier ("fastcall"), NULL, NULL);
   else
     {
-      alt = tree_cons (NULL, build_int_cst (NULL, 2), NULL);
+      alt = tree_cons (NULL, build_int_cst (integer_type_node, 2), NULL);
       alt = tree_cons (get_identifier ("regparm"), alt, NULL);
     }
   decl_attributes (node, alt, flags);
diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index af9ae9f550e..e54a310b2b4 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -7094,7 +7094,7 @@ mips_build_builtin_va_list (void)
                           unsigned_char_type_node);
       /* Explicitly pad to the size of a pointer, so that -Wpadded won't
         warn on every user file.  */
-      index = build_int_cst (NULL_TREE, GET_MODE_SIZE (ptr_mode) - 2 - 1);
+      index = build_int_cst (integer_type_node, GET_MODE_SIZE (ptr_mode) - 2 - 
1);
       array = build_array_type (unsigned_char_type_node,
                                build_index_type (index));
       f_res = build_decl (BUILTINS_LOCATION,
@@ -7408,7 +7408,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, 
gimple_seq *pre_p,
 
       /* [5] Emit code for: off -= rsize.  We do this as a form of
         post-decrement not available to C.  */
-      t = fold_convert (TREE_TYPE (off), build_int_cst (NULL_TREE, rsize));
+      t = fold_convert (TREE_TYPE (off), build_int_cst (integer_type_node, 
rsize));
       t = build2 (POSTDECREMENT_EXPR, TREE_TYPE (off), off, t);
 
       /* [4] Emit code for:
@@ -7435,7 +7435,7 @@ mips_gimplify_va_arg_expr (tree valist, tree type, 
gimple_seq *pre_p,
       /* [10, 11] Emit code for:
         addr_rtx = ovfl + (BYTES_BIG_ENDIAN ? OSIZE - SIZE : 0)
         ovfl += osize.  */
-      u = fold_convert (TREE_TYPE (ovfl), build_int_cst (NULL_TREE, osize));
+      u = fold_convert (TREE_TYPE (ovfl), build_int_cst (integer_type_node, 
osize));
       t = build2 (POSTINCREMENT_EXPR, TREE_TYPE (ovfl), ovfl, u);
       if (BYTES_BIG_ENDIAN && osize > size)
        t = fold_build_pointer_plus_hwi (t, osize - size);
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index 4984ec1c35a..ecc3ff4e24e 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -921,7 +921,7 @@ altivec_build_resolved_builtin (tree *args, int n, tree 
fntype, tree ret_type,
 
       args[0] = c_fold_build2_loc (UNKNOWN_LOCATION, BIT_XOR_EXPR,
                                   TREE_TYPE (args[0]), args[0],
-                                  build_int_cst (NULL_TREE, 2));
+                                  build_int_cst (integer_type_node, 2));
     }
 
   for (int j = 0; j < n; j++)
@@ -1646,7 +1646,7 @@ resolve_vec_step (resolution *res, vec<tree, va_gc> 
*arglist, unsigned nargs)
     }
 
   *res = resolved;
-  return build_int_cst (NULL_TREE, TYPE_VECTOR_SUBPARTS (arg0_type));
+  return build_int_cst (integer_type_node, TYPE_VECTOR_SUBPARTS (arg0_type));
 }
 
 /* Look for a matching instance in a chain of instances.  INSTANCE points to
diff --git a/gcc/config/rs6000/rs6000-call.cc b/gcc/config/rs6000/rs6000-call.cc
index 0da2c1f6071..e458da3e55d 100644
--- a/gcc/config/rs6000/rs6000-call.cc
+++ b/gcc/config/rs6000/rs6000-call.cc
@@ -2509,7 +2509,7 @@ rs6000_va_start (tree valist, rtx nextarg)
   if (cfun->va_list_gpr_size)
     {
       t = build2 (MODIFY_EXPR, TREE_TYPE (gpr), gpr,
-                 build_int_cst (NULL_TREE, n_gpr));
+                 build_int_cst (integer_type_node, n_gpr));
       TREE_SIDE_EFFECTS (t) = 1;
       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
     }
@@ -2517,7 +2517,7 @@ rs6000_va_start (tree valist, rtx nextarg)
   if (cfun->va_list_fpr_size)
     {
       t = build2 (MODIFY_EXPR, TREE_TYPE (fpr), fpr,
-                 build_int_cst (NULL_TREE, n_fpr));
+                 build_int_cst (integer_type_node, n_fpr));
       TREE_SIDE_EFFECTS (t) = 1;
       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
 
diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
index 3aa27c9034c..58091035bcc 100644
--- a/gcc/config/s390/s390-c.cc
+++ b/gcc/config/s390/s390-c.cc
@@ -506,7 +506,7 @@ s390_expand_overloaded_builtin (location_t loc,
                    "vec_step");
          return error_mark_node;
        }
-      return build_int_cst (NULL_TREE,
+      return build_int_cst (integer_type_node,
                            TYPE_VECTOR_SUBPARTS (TREE_TYPE ((*arglist)[0])));
     case S390_OVERLOADED_BUILTIN_s390_vec_xl:
     case S390_OVERLOADED_BUILTIN_s390_vec_xld2:
@@ -1108,7 +1108,7 @@ s390_resolve_overloaded_builtin (location_t loc, tree 
ob_fndecl,
          gcc_assert (type == integer_type_node);
          (*arglist)[i] = build2 (BIT_AND_EXPR, integer_type_node,
                                  fold_convert (integer_type_node, arg),
-                                 build_int_cst (NULL_TREE, n_elem - 1));
+                                 build_int_cst (integer_type_node, n_elem - 
1));
        }
 
       if (TREE_CODE (arg) != INTEGER_CST || !O_IMM_P (op_flags))
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index 038eb57759e..2e799797991 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -13578,7 +13578,7 @@ s390_va_start (tree valist, rtx nextarg 
ATTRIBUTE_UNUSED)
   if (cfun->va_list_gpr_size)
     {
       t = build2 (MODIFY_EXPR, TREE_TYPE (gpr), gpr,
-                 build_int_cst (NULL_TREE, n_gpr));
+                 build_int_cst (integer_type_node, n_gpr));
       TREE_SIDE_EFFECTS (t) = 1;
       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
     }
@@ -13586,7 +13586,7 @@ s390_va_start (tree valist, rtx nextarg 
ATTRIBUTE_UNUSED)
   if (cfun->va_list_fpr_size)
     {
       t = build2 (MODIFY_EXPR, TREE_TYPE (fpr), fpr,
-                 build_int_cst (NULL_TREE, n_fpr));
+                 build_int_cst (integer_type_node, n_fpr));
       TREE_SIDE_EFFECTS (t) = 1;
       expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
     }
diff --git a/gcc/config/stormy16/stormy16.cc b/gcc/config/stormy16/stormy16.cc
index e5acd55ebd6..7ea8327aa41 100644
--- a/gcc/config/stormy16/stormy16.cc
+++ b/gcc/config/stormy16/stormy16.cc
@@ -1460,7 +1460,7 @@ xstormy16_expand_builtin_va_start (tree valist, rtx 
nextarg ATTRIBUTE_UNUSED)
                  NULL_TREE);
 
   t = make_tree (TREE_TYPE (base), virtual_incoming_args_rtx);
-  u = build_int_cst (NULL_TREE, - INCOMING_FRAME_SP_OFFSET);
+  u = build_int_cst (integer_type_node, - INCOMING_FRAME_SP_OFFSET);
   u = fold_convert (TREE_TYPE (count), u);
   t = fold_build_pointer_plus (t, u);
   t = build2 (MODIFY_EXPR, TREE_TYPE (base), base, t);
@@ -1468,7 +1468,7 @@ xstormy16_expand_builtin_va_start (tree valist, rtx 
nextarg ATTRIBUTE_UNUSED)
   expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
 
   t = build2 (MODIFY_EXPR, TREE_TYPE (count), count,
-             build_int_cst (NULL_TREE,
+             build_int_cst (integer_type_node,
                             crtl->args.info * UNITS_PER_WORD));
   TREE_SIDE_EFFECTS (t) = 1;
   expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
diff --git a/gcc/cp/class.cc b/gcc/cp/class.cc
index fac5815390f..e913a780cdd 100644
--- a/gcc/cp/class.cc
+++ b/gcc/cp/class.cc
@@ -8113,7 +8113,7 @@ finish_struct_1 (tree t)
               thunk base function.  */
            DECL_VINDEX (fndecl) = NULL_TREE;
          else if (TREE_CODE (DECL_VINDEX (fndecl)) != INTEGER_CST)
-           DECL_VINDEX (fndecl) = build_int_cst (NULL_TREE, vindex);
+           DECL_VINDEX (fndecl) = build_int_cst (integer_type_node, vindex);
        }
     }
 
@@ -10752,7 +10752,7 @@ build_vtbl_initializer (tree binfo,
            for (i = 0; i < TARGET_VTABLE_USES_DESCRIPTORS; ++i)
              {
                tree fdesc = build2 (FDESC_EXPR, vfunc_ptr_type_node,
-                                    fn, build_int_cst (NULL_TREE, i));
+                                    fn, build_int_cst (integer_type_node, i));
                TREE_CONSTANT (fdesc) = 1;
 
                CONSTRUCTOR_APPEND_ELT (*inits, NULL_TREE, fdesc);
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 369d2a9119d..9ad7c135571 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4145,7 +4145,7 @@ struct GTY(()) lang_decl {
 /* Below are the setter and getter of the NON_DEFAULT_TEMPLATE_ARGS_COUNT
    property.  */
 #define SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE, INT_VALUE) \
-  NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) = build_int_cst (NULL_TREE, INT_VALUE)
+  NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) = build_int_cst (integer_type_node, 
INT_VALUE)
 #if CHECKING_P
 #define GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT(NODE) \
     int_cst_value (NON_DEFAULT_TEMPLATE_ARGS_COUNT (NODE))
diff --git a/gcc/cp/decl.cc b/gcc/cp/decl.cc
index 6e45321e971..7790cea6520 100644
--- a/gcc/cp/decl.cc
+++ b/gcc/cp/decl.cc
@@ -5679,7 +5679,7 @@ cxx_init_decl_processing (void)
   set_call_expr_flags (decl, ECF_NOTHROW | ECF_LEAF);
   SET_DECL_IMMEDIATE_FUNCTION_P (decl);
 
-  integer_two_node = build_int_cst (NULL_TREE, 2);
+  integer_two_node = build_int_cst (integer_type_node, 2);
 
   /* Guess at the initial static decls size.  */
   vec_alloc (static_decls, 500);
@@ -9450,7 +9450,7 @@ omp_declare_variant_finalize_one (tree decl, tree attr)
                  for (tree t = TREE_PURPOSE (TREE_VALUE (adjust_args_list));
                       t; t = TREE_CHAIN (t))
                    TREE_VALUE (t)
-                     = build_int_cst (TREE_TYPE (t),
+                     = build_int_cst (TREE_TYPE (t) ? TREE_TYPE (t) : 
integer_type_node,
                                       tree_to_uhwi (TREE_VALUE (t)) + 1);
                }
              if (DECL_NONSTATIC_MEMBER_P (variant) && append_args_list)
@@ -9459,7 +9459,7 @@ omp_declare_variant_finalize_one (tree decl, tree attr)
                     interop object should be added.  */
                  tree nargs = TREE_CHAIN (TREE_VALUE (adjust_args_list));
                  TREE_PURPOSE (nargs)
-                   = build_int_cst (TREE_TYPE (nargs),
+                   = build_int_cst (TREE_TYPE (nargs) ? TREE_TYPE (nargs) : 
integer_type_node,
                                     tree_to_uhwi (TREE_PURPOSE (nargs)) + 1);
                }
              for (tree t = append_args_list; t; t = TREE_CHAIN (t))
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 967ba3fd542..43b7cc38177 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -14086,7 +14086,7 @@ cp_parser_handle_statement_omp_attributes (cp_parser 
*parser, tree attrs)
       cp_token tok = {};
       tok.type = CPP_PRAGMA;
       tok.keyword = RID_MAX;
-      tok.u.value = build_int_cst (NULL, v->dir->id);
+      tok.u.value = build_int_cst (integer_type_node, v->dir->id);
       tok.location = first->location;
       lexer->buffer->quick_push (tok);
       while (++first < last)
@@ -50525,7 +50525,7 @@ cp_parser_omp_for_loop (cp_parser *parser, enum 
tree_code code, tree clauses,
       error_at (OMP_CLAUSE_LOCATION (ordered_cl),
                "%<ordered%> clause parameter is less than %<collapse%>");
       OMP_CLAUSE_ORDERED_EXPR (ordered_cl)
-       = build_int_cst (NULL_TREE, collapse);
+       = build_int_cst (integer_type_node, collapse);
       ordered = collapse;
     }
 
@@ -54419,7 +54419,7 @@ cp_parser_late_parsing_omp_declare_simd (cp_parser 
*parser, tree attrs,
                cp_token tok = {};
                tok.type = CPP_PRAGMA;
                tok.keyword = RID_MAX;
-               tok.u.value = build_int_cst (NULL, PRAGMA_OMP_DECLARE);
+               tok.u.value = build_int_cst (integer_type_node, 
PRAGMA_OMP_DECLARE);
                tok.location = first->location;
                lexer->buffer->quick_push (tok);
                while (++first < last)
@@ -54544,7 +54544,7 @@ cp_maybe_parse_omp_decl (tree decl, tree d)
   cp_token tok = {};
   tok.type = CPP_PRAGMA;
   tok.keyword = RID_MAX;
-  tok.u.value = build_int_cst (NULL, dir->id);
+  tok.u.value = build_int_cst (integer_type_node, dir->id);
   tok.location = first->location;
   lexer->buffer->quick_push (tok);
   while (++first < last)
@@ -55283,7 +55283,7 @@ cp_parser_omp_metadirective (cp_parser *parser, 
cp_token *pragma_tok,
          cp_token pragma_token;
          pragma_token.type = CPP_PRAGMA;
          pragma_token.location = loc;
-         pragma_token.u.value = build_int_cst (NULL, omp_directive->id);
+         pragma_token.u.value = build_int_cst (integer_type_node, 
omp_directive->id);
 
          directives.safe_push (omp_directive);
          directive_tokens.safe_push (pragma_token);
@@ -55352,7 +55352,7 @@ cp_parser_omp_metadirective (cp_parser *parser, 
cp_token *pragma_tok,
       pragma_token.type = CPP_PRAGMA;
       pragma_token.keyword = RID_MAX;
       pragma_token.location = UNKNOWN_LOCATION;
-      pragma_token.u.value = build_int_cst (NULL, PRAGMA_OMP_NOTHING);
+      pragma_token.u.value = build_int_cst (integer_type_node, 
PRAGMA_OMP_NOTHING);
 
       directives.safe_push (omp_directive);
       directive_tokens.safe_push (pragma_token);
diff --git a/gcc/cp/rtti.cc b/gcc/cp/rtti.cc
index fcca2bec884..ef8f2142e2f 100644
--- a/gcc/cp/rtti.cc
+++ b/gcc/cp/rtti.cc
@@ -173,7 +173,7 @@ build_headof (tree exp)
   exp = save_expr (exp);
 
   /* The offset-to-top field is at index -2 from the vptr.  */
-  index = build_int_cst (NULL_TREE,
+  index = build_int_cst (integer_type_node,
                         -2 * TARGET_VTABLE_DATA_ENTRY_DISTANCE);
 
   offset = build_vtbl_ref (cp_build_fold_indirect_ref (exp),
@@ -279,7 +279,7 @@ get_tinfo_ptr_dynamic (tree exp, tsubst_flags_t complain, 
tree tinfo_ptr_type)
       tree index;
 
       /* The RTTI information is at index -1.  */
-      index = build_int_cst (NULL_TREE,
+      index = build_int_cst (integer_type_node,
                             -1 * TARGET_VTABLE_DATA_ENTRY_DISTANCE);
       t = build_vtbl_ref (exp, index);
       t = convert (tinfo_ptr_type, t);
@@ -1084,7 +1084,7 @@ ptr_initializer (tinfo_s *ti, tree target)
       to = build_exception_variant (to, NULL_TREE);
     }
   CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, init);
-  CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, flags));
+  CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, 
flags));
   CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
                          get_void_tinfo_ptr (TYPE_MAIN_VARIANT (to)));
 
@@ -1115,7 +1115,7 @@ ptm_initializer (tinfo_s *ti, tree target)
   if (!COMPLETE_TYPE_P (klass))
     flags |= 0x10;
   CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, init);
-  CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, flags));
+  CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (integer_type_node, 
flags));
   CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
                          get_void_tinfo_ptr (TYPE_MAIN_VARIANT (to)));
   CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, get_void_tinfo_ptr (klass));
@@ -1273,8 +1273,8 @@ get_pseudo_ti_init (tree type, unsigned tk_index)
        /* get_tinfo_ptr might have reallocated the tinfo_descs vector.  */
        ti = &(*tinfo_descs)[tk_index];
        return class_initializer (ti, type, 3,
-                                 build_int_cst (NULL_TREE, hint),
-                                 build_int_cst (NULL_TREE, nbases),
+                                 build_int_cst (integer_type_node, hint),
+                                 build_int_cst (integer_type_node, nbases),
                                  base_inits);
       }
     }
diff --git a/gcc/d/d-builtins.cc b/gcc/d/d-builtins.cc
index 4f42c11cd7d..a43990dde04 100644
--- a/gcc/d/d-builtins.cc
+++ b/gcc/d/d-builtins.cc
@@ -1059,7 +1059,7 @@ d_init_attributes (void)
 #define DEF_ATTR_NULL_TREE(ENUM)       \
   built_in_attributes[(int) ENUM] = NULL_TREE;
 # define DEF_ATTR_INT(ENUM, VALUE)     \
-  built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
+  built_in_attributes[(int) ENUM] = build_int_cst (integer_type_node, VALUE);
 #define DEF_ATTR_STRING(ENUM, VALUE)   \
   built_in_attributes[(int) ENUM] = build_string (strlen (VALUE), VALUE);
 #define DEF_ATTR_IDENT(ENUM, STRING)   \
diff --git a/gcc/expr.cc b/gcc/expr.cc
index feaa8e90470..e09dab95953 100644
--- a/gcc/expr.cc
+++ b/gcc/expr.cc
@@ -13809,7 +13809,7 @@ maybe_optimize_mod_cmp (enum tree_code code, tree 
*arg0, tree *arg1)
     t = fold_build2_loc (loc, PLUS_EXPR, type, t, c5);
   if (shift)
     {
-      tree s = build_int_cst (NULL_TREE, shift);
+      tree s = build_int_cst (integer_type_node, shift);
       t = fold_build2_loc (loc, RROTATE_EXPR, type, t, s);
     }
 
diff --git a/gcc/gimple-lower-bitint.cc b/gcc/gimple-lower-bitint.cc
index e36534ba13d..a4a27aa4360 100644
--- a/gcc/gimple-lower-bitint.cc
+++ b/gcc/gimple-lower-bitint.cc
@@ -1468,7 +1468,7 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, 
tree idx)
                                                  ? high - 1 - low : low));
              m_first = false;
              m_data[save_data_cnt + 2]
-               = build_int_cst (NULL_TREE, m_data_cnt);
+               = build_int_cst (integer_type_node, m_data_cnt);
              m_data_cnt = save_data_cnt;
              t = add_cast (signed_type_for (m_limb_type), t);
              tree lpm1 = build_int_cst (unsigned_type_node, limb_prec - 1);
@@ -1518,7 +1518,7 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, 
tree idx)
              rhs1 = handle_operand (rhs1, idx);
              if (m_first)
                m_data[save_data_cnt + 2]
-                 = build_int_cst (NULL_TREE, m_data_cnt);
+                 = build_int_cst (integer_type_node, m_data_cnt);
              m_first = save_first;
              return rhs1;
            }
@@ -1570,7 +1570,7 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, 
tree idx)
          t1 = handle_operand (rhs1, t1);
          if (m_first)
            m_data[save_data_cnt + 2]
-             = build_int_cst (NULL_TREE, m_data_cnt);
+             = build_int_cst (integer_type_node, m_data_cnt);
          tree ext = NULL_TREE;
          tree bitfld = NULL_TREE;
          if (!single_comparison)
@@ -1699,7 +1699,7 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, 
tree idx)
                                         ? size_int (high - 1 - tidx) : idx));
              if (m_first)
                m_data[save_data_cnt + 2]
-                 = build_int_cst (NULL_TREE, m_data_cnt);
+                 = build_int_cst (integer_type_node, m_data_cnt);
            }
          else if (tidx < high)
            {
@@ -1707,7 +1707,7 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, 
tree idx)
                                                  ? high - 1 - low : low));
              if (m_first)
                m_data[save_data_cnt + 2]
-                 = build_int_cst (NULL_TREE, m_data_cnt);
+                 = build_int_cst (integer_type_node, m_data_cnt);
              if (!useless_type_conversion_p (m_limb_type, TREE_TYPE (t)))
                t = add_cast (m_limb_type, t);
              tree ext = NULL_TREE;
@@ -1731,7 +1731,7 @@ bitint_large_huge::handle_cast (tree lhs_type, tree rhs1, 
tree idx)
                                         ? size_int (high - 1)
                                         : size_zero_node));
                  m_data[save_data_cnt + 2]
-                   = build_int_cst (NULL_TREE, m_data_cnt);
+                   = build_int_cst (integer_type_node, m_data_cnt);
                }
              else
                m_data_cnt = tree_to_uhwi (m_data[save_data_cnt + 2]);
diff --git a/gcc/gimple-ssa-store-merging.cc b/gcc/gimple-ssa-store-merging.cc
index 71cb7d8031a..39ef59ab9a6 100644
--- a/gcc/gimple-ssa-store-merging.cc
+++ b/gcc/gimple-ssa-store-merging.cc
@@ -1456,7 +1456,7 @@ bswap_replace (gimple_stmt_iterator gsi, gimple 
*ins_stmt, tree fndecl,
      gives 0x03040102 while a bswap for that value is 0x04030201.  */
   if (bswap && n->range == 16)
     {
-      tree count = build_int_cst (NULL, BITS_PER_UNIT);
+      tree count = build_int_cst (integer_type_node, BITS_PER_UNIT);
       src = fold_build2 (LROTATE_EXPR, bswap_type, tmp, count);
       bswap_stmt = gimple_build_assign (NULL, src);
     }
@@ -4801,12 +4801,12 @@ imm_store_chain_info::output_merged_store 
(merged_store_group *group)
                  if (shift < 0)
                    tem = gimple_build (&seq, loc,
                                        RSHIFT_EXPR, TREE_TYPE (tem), tem,
-                                       build_int_cst (NULL_TREE, -shift));
+                                       build_int_cst (integer_type_node, 
-shift));
                  tem = gimple_convert (&seq, loc, dest_type, tem);
                  if (shift > 0)
                    tem = gimple_build (&seq, loc,
                                        LSHIFT_EXPR, dest_type, tem,
-                                       build_int_cst (NULL_TREE, shift));
+                                       build_int_cst (integer_type_node, 
shift));
                  src = gimple_build (&seq, loc,
                                      BIT_IOR_EXPR, dest_type, tem, src);
                }
diff --git a/gcc/lto/lto-lang.cc b/gcc/lto/lto-lang.cc
index 82d0c523dcb..d7697110398 100644
--- a/gcc/lto/lto-lang.cc
+++ b/gcc/lto/lto-lang.cc
@@ -696,7 +696,7 @@ lto_init_attributes (void)
 #define DEF_ATTR_NULL_TREE(ENUM)                               \
   built_in_attributes[(int) ENUM] = NULL_TREE;
 #define DEF_ATTR_INT(ENUM, VALUE)                              \
-  built_in_attributes[(int) ENUM] = build_int_cst (NULL_TREE, VALUE);
+  built_in_attributes[(int) ENUM] = build_int_cst (integer_type_node, VALUE);
 #define DEF_ATTR_STRING(ENUM, VALUE)                           \
   built_in_attributes[(int) ENUM] = build_string (strlen (VALUE), VALUE);
 #define DEF_ATTR_IDENT(ENUM, STRING)                           \
diff --git a/gcc/objc/objc-act.cc b/gcc/objc/objc-act.cc
index 3ed82fe823e..4ee7ae50bba 100644
--- a/gcc/objc/objc-act.cc
+++ b/gcc/objc/objc-act.cc
@@ -10032,7 +10032,7 @@ objc_finish_foreach_loop (location_t location, tree 
object_expression, tree coll
       t = build2 (MODIFY_EXPR, void_type_node,
                  build_array_ref (location, objc_build_component_ref 
(objc_foreach_enum_state_decl,
                                                                       
get_identifier ("extra")),
-                                  build_int_cst (NULL_TREE, i)),
+                                  build_int_cst (integer_type_node, i)),
                  build_int_cst (long_unsigned_type_node, 0));
       SET_EXPR_LOCATION (t, location);
       append_to_statement_list (t, &BIND_EXPR_BODY (bind));
@@ -10048,7 +10048,7 @@ objc_finish_foreach_loop (location_t location, tree 
object_expression, tree coll
                                 tree_cons   /* __objc_foreach_items  */
                                 (NULL_TREE, objc_foreach_items_decl,
                                  tree_cons  /* 16 */
-                                 (NULL_TREE, build_int_cst (NULL_TREE, 16), 
NULL_TREE))), NULL);
+                                 (NULL_TREE, build_int_cst (integer_type_node, 
16), NULL_TREE))), NULL);
 #else
   /* In C, we need to decay the __objc_foreach_items array that we are 
passing.  */
   {
@@ -10061,7 +10061,7 @@ objc_finish_foreach_loop (location_t location, tree 
object_expression, tree coll
                                   tree_cons   /* __objc_foreach_items  */
                                   (NULL_TREE, 
default_function_array_conversion (location, array).value,
                                    tree_cons  /* 16 */
-                                   (NULL_TREE, build_int_cst (NULL_TREE, 16), 
NULL_TREE))), NULL);
+                                   (NULL_TREE, build_int_cst 
(integer_type_node, 16), NULL_TREE))), NULL);
   }
 #endif
   t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl,
@@ -10222,7 +10222,7 @@ objc_finish_foreach_loop (location_t location, tree 
object_expression, tree coll
                                 tree_cons   /* __objc_foreach_items  */
                                 (NULL_TREE, objc_foreach_items_decl,
                                  tree_cons  /* 16 */
-                                 (NULL_TREE, build_int_cst (NULL_TREE, 16), 
NULL_TREE))), NULL);
+                                 (NULL_TREE, build_int_cst (integer_type_node, 
16), NULL_TREE))), NULL);
 #else
   /* In C, we need to decay the __objc_foreach_items array that we are 
passing.  */
   {
@@ -10235,7 +10235,7 @@ objc_finish_foreach_loop (location_t location, tree 
object_expression, tree coll
                                   tree_cons   /* __objc_foreach_items  */
                                   (NULL_TREE, 
default_function_array_conversion (location, array).value,
                                    tree_cons  /* 16 */
-                                   (NULL_TREE, build_int_cst (NULL_TREE, 16), 
NULL_TREE))), NULL);
+                                   (NULL_TREE, build_int_cst 
(integer_type_node, 16), NULL_TREE))), NULL);
   }
 #endif
   t = build2 (MODIFY_EXPR, void_type_node, objc_foreach_batchsize_decl,
diff --git a/gcc/objc/objc-gnu-runtime-abi-01.cc 
b/gcc/objc/objc-gnu-runtime-abi-01.cc
index 836b4ae92f3..2451bc30864 100644
--- a/gcc/objc/objc-gnu-runtime-abi-01.cc
+++ b/gcc/objc/objc-gnu-runtime-abi-01.cc
@@ -924,7 +924,7 @@ gnu_runtime_abi_01_build_const_string_constructor 
(location_t loc, tree string,
 
   /* GNU:    (NXConstantString *) & ((__builtin_ObjCString) { NULL, string, 
length })  */
   fields = first_type_field (internal_const_str_type);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, 0));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, 0));
 
   fields = next_type_field (fields);
   TREE_ADDRESSABLE (string) = true;
@@ -932,7 +932,7 @@ gnu_runtime_abi_01_build_const_string_constructor 
(location_t loc, tree string,
                                                     ADDR_EXPR, string, 1));
 
   fields = next_type_field (fields);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, length));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, 
length));
   constructor = objc_build_constructor (internal_const_str_type, v);
 
   constructor = objc_add_static_instance (constructor, constant_string_type);
@@ -1163,7 +1163,7 @@ generate_protocol_list (tree i_or_p, tree klass_ctxt)
   vec<constructor_elt, va_gc> *v = NULL;
   unsigned n = 0;
   tree idx = size_int (n++);
-  CONSTRUCTOR_APPEND_ELT (v, idx, build_int_cst (NULL_TREE, 0));
+  CONSTRUCTOR_APPEND_ELT (v, idx, build_int_cst (integer_type_node, 0));
   tree e = build_int_cst (build_pointer_type (objc_protocol_template), size);
   idx = size_int (n++);
   CONSTRUCTOR_APPEND_ELT (v, idx, e);
@@ -1233,7 +1233,7 @@ generate_v1_meth_descriptor_table (tree chain, tree 
protocol, const char *prefix
   tree decl = start_meta_decl (method_list_template, buf);
   vec<constructor_elt, va_gc> *v = NULL;
   tree fields = first_type_field (method_list_template);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, size));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, size));
   tree initlist
     = build_descriptor_table_initializer (objc_method_prototype_template,
                                          chain);
@@ -1557,15 +1557,15 @@ build_shared_structure_initializer (tree type, tree 
isa, tree super,
 
   /* dtable = */
   fields = next_type_field (fields);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, 0));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, 0));
 
   /* subclass_list = */
   fields = next_type_field (fields);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, 0));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, 0));
 
   /* sibling_class = */
   fields = next_type_field (fields);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, 0));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, 0));
 
   /* protocol_list = */
   tree ltyp = build_pointer_type (build_pointer_type (objc_protocol_template));
@@ -1605,7 +1605,7 @@ generate_ivars_list (tree chain, const char *name)
   tree decl = start_meta_decl (ivar_list_template, name);
   vec<constructor_elt, va_gc> *inits = NULL;
   tree fields = first_type_field (ivar_list_template);
-  CONSTRUCTOR_APPEND_ELT (inits, fields, build_int_cst (NULL_TREE, size));
+  CONSTRUCTOR_APPEND_ELT (inits, fields, build_int_cst (integer_type_node, 
size));
   fields = next_type_field (fields);
   CONSTRUCTOR_APPEND_ELT (inits, fields, initlist);
 
@@ -1798,7 +1798,7 @@ get_proto_encoding (tree proto)
       return add_objc_string (encoding, meth_var_types);
     }
   else
-    return build_int_cst (NULL_TREE, 0);
+    return build_int_cst (integer_type_node, 0);
 }
 
 static void
diff --git a/gcc/objc/objc-next-runtime-abi-01.cc 
b/gcc/objc/objc-next-runtime-abi-01.cc
index 980b6bdc545..6829a1ed670 100644
--- a/gcc/objc/objc-next-runtime-abi-01.cc
+++ b/gcc/objc/objc-next-runtime-abi-01.cc
@@ -330,7 +330,7 @@ static void next_runtime_01_initialize (void)
   TREE_NOTHROW (umsg_fast_decl) = 0;
   DECL_ATTRIBUTES (umsg_fast_decl)
        = tree_cons (get_identifier ("hard_coded_address"),
-                    build_int_cst (NULL_TREE, OFFS_MSGSEND_FAST),
+                    build_int_cst (integer_type_node, OFFS_MSGSEND_FAST),
                     NULL_TREE);
 #else
   /* No direct dispatch available.  */
@@ -1028,7 +1028,7 @@ next_runtime_abi_01_build_const_string_constructor 
(location_t loc, tree string,
 
   /* ??? check if this should be long.  */
   fields = next_type_field (fields);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, length));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, 
length));
   tree constructor = objc_build_constructor (internal_const_str_type, v);
 
   tree var = objc_build_decl (loc, CONST_DECL, NULL, TREE_TYPE (constructor));
@@ -1171,7 +1171,7 @@ generate_v1_meth_descriptor_table (tree chain, tree 
protocol,
   vec<constructor_elt, va_gc> *v = NULL;
 
   tree fields = first_type_field (method_list_template);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, size));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, size));
   tree initlist
     = build_descriptor_table_initializer (objc_method_prototype_template,
                                          chain);
@@ -1786,7 +1786,7 @@ build_v1_category_initializer (tree type, tree cat_name, 
tree class_name,
   if (flag_objc_abi >= 1)
     {
       int val = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_category_template));
-      expr = build_int_cst (NULL_TREE, val);
+      expr = build_int_cst (integer_type_node, val);
       fields = next_type_field (fields);
       CONSTRUCTOR_APPEND_ELT (v, fields, expr);
       ltyp = objc_prop_list_ptr;
@@ -2578,7 +2578,7 @@ build_next_objc_exception_stuff (void)
                            NOT_BUILT_IN, NULL, NULL_TREE);
   DECL_ATTRIBUTES (objc_assign_ivar_fast_decl)
     = tree_cons (get_identifier ("hard_coded_address"),
-                build_int_cst (NULL_TREE, OFFS_ASSIGNIVAR_FAST),
+                build_int_cst (integer_type_node, OFFS_ASSIGNIVAR_FAST),
                 NULL_TREE);
 #else
   /* Default to slower ivar method.  */
diff --git a/gcc/objc/objc-next-runtime-abi-02.cc 
b/gcc/objc/objc-next-runtime-abi-02.cc
index 1863192e80e..5ae433b6955 100644
--- a/gcc/objc/objc-next-runtime-abi-02.cc
+++ b/gcc/objc/objc-next-runtime-abi-02.cc
@@ -1943,7 +1943,7 @@ next_runtime_abi_02_build_const_string_constructor 
(location_t loc, tree string,
 
   /* ??? check if this should be long.  */
   fields = next_type_field (fields);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, length));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, 
length));
   constructor = objc_build_constructor (internal_const_str_type, v);
 
   var = objc_build_decl (input_location, CONST_DECL, NULL, TREE_TYPE 
(constructor));
@@ -2511,9 +2511,9 @@ generate_v2_meth_descriptor_table (tree chain, tree 
protocol,
   vec<constructor_elt, va_gc> *v = NULL;
   int entsize = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (objc_method_template));
   tree fields = first_type_field (method_list_template);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, entsize));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, 
entsize));
   fields = next_type_field (fields);
-  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (NULL_TREE, size));
+  CONSTRUCTOR_APPEND_ELT (v, fields, build_int_cst (integer_type_node, size));
   tree initlist =
        build_v2_descriptor_table_initializer (objc_method_template,
                                            chain);
@@ -2843,7 +2843,7 @@ generate_v2_protocols (void)
        refs_expr = convert (build_pointer_type (objc_v2_protocol_template),
                             build_unary_op (loc, ADDR_EXPR, refs_decl, 0));
       else
-       refs_expr = build_int_cst (NULL_TREE, 0);
+       refs_expr = build_int_cst (integer_type_node, 0);
 
       props = generate_v2_property_table (p, NULL_TREE);
 
diff --git a/gcc/objc/objc-runtime-shared-support.cc 
b/gcc/objc/objc-runtime-shared-support.cc
index 7e1c77d500d..51c9278eef8 100644
--- a/gcc/objc/objc-runtime-shared-support.cc
+++ b/gcc/objc/objc-runtime-shared-support.cc
@@ -577,7 +577,7 @@ build_ivar_list_initializer (tree type, tree field_decl)
        else
          /* Unnamed bit-field ivar (yuck).  */
          CONSTRUCTOR_APPEND_ELT (ivar, fields,
-                                 build_int_cst (NULL_TREE, 0));
+                                 build_int_cst (integer_type_node, 0));
 
        /* Set type.  */
        fields = next_type_field (fields);
diff --git a/gcc/omp-expand.cc b/gcc/omp-expand.cc
index d3eb3d9fa32..9304b16f468 100644
--- a/gcc/omp-expand.cc
+++ b/gcc/omp-expand.cc
@@ -9257,7 +9257,7 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
      use the RELAXED memory model.  */
   call = build_call_expr_loc (loc, decl, 3, addr,
                              fold_convert_loc (loc, itype, rhs),
-                             build_int_cst (NULL, mo));
+                             build_int_cst (integer_type_node, mo));
 
   if (need_old || need_new)
     {
@@ -9408,8 +9408,8 @@ expand_omp_atomic_cas (basic_block load_bb, tree addr,
   bool need_old = gimple_omp_atomic_need_value_p (load_stmt);
   bool weak = gimple_omp_atomic_weak_p (load_stmt);
   enum omp_memory_order omo = gimple_omp_atomic_memory_order (load_stmt);
-  tree mo = build_int_cst (NULL, omp_memory_order_to_memmodel (omo));
-  tree fmo = build_int_cst (NULL, omp_memory_order_to_fail_memmodel (omo));
+  tree mo = build_int_cst (integer_type_node, omp_memory_order_to_memmodel 
(omo));
+  tree fmo = build_int_cst (integer_type_node, 
omp_memory_order_to_fail_memmodel (omo));
   gcc_checking_assert (!need_old || !need_new);
 
   enum built_in_function fncode
@@ -9583,8 +9583,8 @@ expand_omp_atomic_pipeline (basic_block load_bb, 
basic_block store_bb,
   gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_ATOMIC_LOAD);
   location_t loc = gimple_location (gsi_stmt (si));
   enum omp_memory_order omo = gimple_omp_atomic_memory_order (gsi_stmt (si));
-  tree mo = build_int_cst (NULL, omp_memory_order_to_memmodel (omo));
-  tree fmo = build_int_cst (NULL, omp_memory_order_to_fail_memmodel (omo));
+  tree mo = build_int_cst (integer_type_node, omp_memory_order_to_memmodel 
(omo));
+  tree fmo = build_int_cst (integer_type_node, 
omp_memory_order_to_fail_memmodel (omo));
 
   /* For floating-point values, we'll need to view-convert them to integers
      so that we can perform the atomic compare and swap.  Simplify the
@@ -9618,7 +9618,7 @@ expand_omp_atomic_pipeline (basic_block load_bb, 
basic_block store_bb,
     initial
       = fold_convert (atype,
                      build_call_expr (loaddecl, 2, iaddr,
-                                      build_int_cst (NULL_TREE,
+                                      build_int_cst (integer_type_node,
                                                      MEMMODEL_RELAXED)));
   else
     {
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc
index 567f0f82f2c..bcc482fb839 100644
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -10142,7 +10142,7 @@ lower_omp_ordered (gimple_stmt_iterator *gsi_p, 
omp_context *ctx)
   if (simd)
     {
       x = gimple_build_call_internal (IFN_GOMP_SIMD_ORDERED_START, 1,
-                                     build_int_cst (NULL_TREE, threads));
+                                     build_int_cst (integer_type_node, 
threads));
       cfun->has_simduid_loops = true;
     }
   else
@@ -10202,7 +10202,7 @@ lower_omp_ordered (gimple_stmt_iterator *gsi_p, 
omp_context *ctx)
     }
   if (simd)
     x = gimple_build_call_internal (IFN_GOMP_SIMD_ORDERED_END, 1,
-                                   build_int_cst (NULL_TREE, threads));
+                                   build_int_cst (integer_type_node, threads));
   else
     x = gimple_build_call (builtin_decl_explicit (BUILT_IN_GOMP_ORDERED_END),
                           0);
diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc
index 4f189f243a0..1d670d4f11f 100644
--- a/gcc/omp-simd-clone.cc
+++ b/gcc/omp-simd-clone.cc
@@ -1574,7 +1574,7 @@ simd_clone_adjust (struct cgraph_node *node)
              c--;
              tree idx = make_ssa_name (TREE_TYPE (iter1));
              g = gimple_build_assign (idx, RSHIFT_EXPR, iter1,
-                                      build_int_cst (NULL_TREE, s));
+                                      build_int_cst (integer_type_node, s));
              gsi_insert_after (&gsi, g, GSI_CONTINUE_LINKING);
              mask = make_ssa_name (TREE_TYPE (TREE_TYPE (mask_array)));
              tree aref = build4 (ARRAY_REF,
diff --git a/gcc/trans-mem.cc b/gcc/trans-mem.cc
index 7b894eef3ae..0fa71841700 100644
--- a/gcc/trans-mem.cc
+++ b/gcc/trans-mem.cc
@@ -5065,7 +5065,7 @@ ipa_tm_insert_irr_call (struct cgraph_node *node, struct 
tm_region *region,
   transaction_subcode_ior (region, GTMA_MAY_ENTER_IRREVOCABLE);
 
   g = gimple_build_call (builtin_decl_explicit (BUILT_IN_TM_IRREVOCABLE),
-                        1, build_int_cst (NULL_TREE, MODE_SERIALIRREVOCABLE));
+                        1, build_int_cst (integer_type_node, 
MODE_SERIALIRREVOCABLE));
 
   split_block_after_labels (bb);
   gsi = gsi_after_labels (bb);
diff --git a/gcc/tree-data-ref.cc b/gcc/tree-data-ref.cc
index db77e4ead72..d6da0fe58c3 100644
--- a/gcc/tree-data-ref.cc
+++ b/gcc/tree-data-ref.cc
@@ -4173,16 +4173,16 @@ compute_overlap_steps_for_affine_univar (HOST_WIDE_INT 
niter,
          tau2 = FLOOR_DIV (niter, step_overlaps_a);
          tau2 = MIN (tau2, FLOOR_DIV (niter, step_overlaps_b));
          last_conflict = tau2;
-         *last_conflicts = build_int_cst (NULL_TREE, last_conflict);
+         *last_conflicts = build_int_cst (integer_type_node, last_conflict);
        }
       else
        *last_conflicts = chrec_dont_know;
 
       *overlaps_a = affine_fn_univar (integer_zero_node, dim,
-                                     build_int_cst (NULL_TREE,
+                                     build_int_cst (integer_type_node,
                                                     step_overlaps_a));
       *overlaps_b = affine_fn_univar (integer_zero_node, dim,
-                                     build_int_cst (NULL_TREE,
+                                     build_int_cst (integer_type_node,
                                                     step_overlaps_b));
     }
 
@@ -4734,14 +4734,14 @@ analyze_subscript_affine_affine (tree chrec_a,
 
              *overlaps_a
                = conflict_fn (1,
-                              affine_fn_univar (build_int_cst (NULL_TREE, x1),
+                              affine_fn_univar (build_int_cst 
(integer_type_node, x1),
                                                 1,
-                                                build_int_cst (NULL_TREE, 
i1)));
+                                                build_int_cst 
(integer_type_node, i1)));
              *overlaps_b
                = conflict_fn (1,
-                              affine_fn_univar (build_int_cst (NULL_TREE, y1),
+                              affine_fn_univar (build_int_cst 
(integer_type_node, y1),
                                                 1,
-                                                build_int_cst (NULL_TREE, 
j1)));
+                                                build_int_cst 
(integer_type_node, j1)));
            }
          else
            {
diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc
index b1491bd39ad..5f9086615e3 100644
--- a/gcc/tree-vect-generic.cc
+++ b/gcc/tree-vect-generic.cc
@@ -482,7 +482,7 @@ add_shift (gimple_stmt_iterator *gsi, tree type, tree op0, 
int *shiftcnts,
       if (op != unknown_optab
          && can_implement_p (op, TYPE_MODE (type)))
        return gimplify_build2 (gsi, code, type, op0,
-                               build_int_cst (NULL_TREE, shiftcnts[0]));
+                               build_int_cst (integer_type_node, 
shiftcnts[0]));
     }
 
   op = optab_for_tree_code (code, type, optab_vector);
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index 58710b2a5fd..5fcc37f053c 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -5645,7 +5645,7 @@ vect_recog_divmod_pattern (vec_info *vinfo,
              t1 = vect_recog_temp_ssa_var (itype, NULL);
              def_stmt
                = gimple_build_assign (t1, RSHIFT_EXPR, oprnd0,
-                                      build_int_cst (NULL, pre_shift));
+                                      build_int_cst (integer_type_node, 
pre_shift));
              append_pattern_def_seq (vinfo, stmt_vinfo, def_stmt);
            }
          else
diff --git a/gcc/tsan.cc b/gcc/tsan.cc
index 5132571f105..d6e3361346c 100644
--- a/gcc/tsan.cc
+++ b/gcc/tsan.cc
@@ -537,7 +537,7 @@ instrument_builtin_call (gimple_stmt_iterator *gsi)
              args[j] = gimple_call_arg (stmt, j);
            for (; j < 2; j++)
              args[j] = NULL_TREE;
-           args[num] = build_int_cst (NULL_TREE,
+           args[num] = build_int_cst (integer_type_node,
                                       tsan_atomic_table[i].action
                                       != add_acquire
                                       ? MEMMODEL_SEQ_CST
@@ -616,9 +616,9 @@ instrument_builtin_call (gimple_stmt_iterator *gsi)
            lhs = gimple_call_lhs (stmt);
            update_gimple_call (gsi, decl, 5, args[0],
                                build_fold_addr_expr (t), args[2],
-                               build_int_cst (NULL_TREE,
+                               build_int_cst (integer_type_node,
                                               MEMMODEL_SEQ_CST),
-                               build_int_cst (NULL_TREE,
+                               build_int_cst (integer_type_node,
                                               MEMMODEL_SEQ_CST));
            maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (*gsi));
            if (tsan_atomic_table[i].action == val_cas && lhs)
@@ -644,7 +644,7 @@ instrument_builtin_call (gimple_stmt_iterator *gsi)
            t = TREE_VALUE (TREE_CHAIN (t));
            update_gimple_call (gsi, decl, 3, gimple_call_arg (stmt, 0),
                                build_int_cst (t, 0),
-                               build_int_cst (NULL_TREE,
+                               build_int_cst (integer_type_node,
                                               MEMMODEL_RELEASE));
            maybe_clean_or_replace_eh_stmt (stmt, gsi_stmt (*gsi));
            return;
-- 
2.55.0

Reply via email to