aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-06-24 15:56:12 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-06-24 16:03:18 +0100
commit71c644f430edbae114396c075baab330889c698c (patch)
tree84d12952ec7c8c9830337dd48f3b452f320353bb /gcc/rust/backend
parentc87f2c72dcfa67f1a78fafacaf49043f11c7df6a (diff)
downloadgcc-71c644f430edbae114396c075baab330889c698c.zip
gcc-71c644f430edbae114396c075baab330889c698c.tar.gz
gcc-71c644f430edbae114396c075baab330889c698c.tar.bz2
Change unit-type from void_type_node to a zero sized unsigned integer
GCC does not support unit-type when it is represented as void, unsigned integer of precision zero seems to work. The missing piece here is that functions with return type of unit are still represented by a void type node there is an ICE in ``` 0x1d551d5 wi::min_value(unsigned int,signop) ../../gccrs/gcc/wide-int.cc:346 ``` Addresses #155
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-context.h4
-rw-r--r--gcc/rust/backend/rust-compile-tyty.h6
2 files changed, 4 insertions, 6 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h
index 5bd1e96..e0c9352 100644
--- a/gcc/rust/backend/rust-compile-context.h
+++ b/gcc/rust/backend/rust-compile-context.h
@@ -423,7 +423,7 @@ public:
{
if (type.num_fields () == 0)
{
- translated = ctx->get_backend ()->void_type ();
+ translated = ctx->get_backend ()->unit_type ();
return;
}
@@ -544,7 +544,7 @@ public:
void visit (TyTy::NeverType &) override
{
- translated = ctx->get_backend ()->void_type ();
+ translated = ctx->get_backend ()->unit_type ();
}
private:
diff --git a/gcc/rust/backend/rust-compile-tyty.h b/gcc/rust/backend/rust-compile-tyty.h
index ba98ac0..8576235 100644
--- a/gcc/rust/backend/rust-compile-tyty.h
+++ b/gcc/rust/backend/rust-compile-tyty.h
@@ -42,8 +42,6 @@ public:
return compiler.translated;
}
- ~TyTyCompile () {}
-
void visit (TyTy::ErrorType &) override { gcc_unreachable (); }
void visit (TyTy::InferType &) override { gcc_unreachable (); }
@@ -53,7 +51,7 @@ public:
void visit (TyTy::TupleType &type) override
{
if (type.num_fields () == 0)
- translated = backend->void_type ();
+ translated = backend->unit_type ();
else
gcc_unreachable ();
}
@@ -224,7 +222,7 @@ public:
void visit (TyTy::NeverType &) override
{
- translated = backend->void_type ();
+ translated = backend->unit_type ();
}
private: