diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-11-17 15:39:02 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-12-06 16:08:07 +0100 |
commit | 50cd4d91e339233caf756f2366555ea8a01b5787 (patch) | |
tree | 05f633711de4e34876bec723ec220318f62df9d5 /gcc | |
parent | 9666f2b169b5192b5c827d605cc80e6987e1aac5 (diff) | |
download | gcc-50cd4d91e339233caf756f2366555ea8a01b5787.zip gcc-50cd4d91e339233caf756f2366555ea8a01b5787.tar.gz gcc-50cd4d91e339233caf756f2366555ea8a01b5787.tar.bz2 |
backend: Use build_int_cstu for size expressions
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index e50df63..2c5c2b4 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -2220,9 +2220,7 @@ CompileExpr::compile_string_literal (const HIR::LiteralExpr &expr, rust_assert (ok); tree type = TyTyResolveCompile::compile (ctx, usize); - mpz_t ival; - mpz_init_set_ui (ival, literal_value.as_string ().size ()); - tree size = double_int_to_tree (type, mpz_get_double_int (type, ival, true)); + tree size = build_int_cstu (type, literal_value.as_string ().size ()); return ctx->get_backend ()->constructor_expression (fat_pointer, false, {data, size}, -1, @@ -2618,7 +2616,7 @@ HIRCompileBase::resolve_unsized_slice_adjustment ( TYPE_PRECISION (TREE_TYPE (domain)), TYPE_SIGN (TREE_TYPE (domain))) .to_uhwi (); - tree size = build_int_cst (size_type_node, array_size); + tree size = build_int_cstu (size_type_node, array_size); return ctx->get_backend ()->constructor_expression (fat_pointer, false, {data, size}, -1, locus); |