diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-05-10 17:51:05 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-05-10 18:01:23 +0100 |
commit | 2e65c14bef940fa2f7dff4f407178af21488b76e (patch) | |
tree | e037226b7226ab0765d526b5c5511f6af6310e37 /gcc/rust/backend/rust-compile-expr.cc | |
parent | 03c21a08eb40b71e67da0c8ae83ed2c645fb76a3 (diff) | |
download | gcc-2e65c14bef940fa2f7dff4f407178af21488b76e.zip gcc-2e65c14bef940fa2f7dff4f407178af21488b76e.tar.gz gcc-2e65c14bef940fa2f7dff4f407178af21488b76e.tar.bz2 |
Allow cast of integers to pointers
This adds the cast rules of integer types and integer inference variables
to pointers. The code-generation needed to remove the bad assertion that
all integer literals were always going to be of type integer. This also
needed a tweak to a bad port from the cp/constexpr.cc code which assumed
that all integer_cst of pointer types would be a zero pointer which was
used to detect cases of bad method pointers in CPP which we does not apply
here.
see gcc/cp/constexpr.cc:6564-6488
Fixes #1226
Diffstat (limited to 'gcc/rust/backend/rust-compile-expr.cc')
-rw-r--r-- | gcc/rust/backend/rust-compile-expr.cc | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc index 1cf4e3d..0307df1 100644 --- a/gcc/rust/backend/rust-compile-expr.cc +++ b/gcc/rust/backend/rust-compile-expr.cc @@ -903,7 +903,6 @@ CompileExpr::compile_integer_literal (const HIR::LiteralExpr &expr, const auto literal_value = expr.get_literal (); tree type = TyTyResolveCompile::compile (ctx, tyty); - rust_assert (TREE_CODE (type) == INTEGER_TYPE); mpz_t ival; if (mpz_init_set_str (ival, literal_value.as_string ().c_str (), 10) != 0) |