[PATCH] Actually set TYPE_PACKED for type_record

Mark Wielaard mark@klomp.org
Sun Jun 19 00:01:35 GMT 2022


When bootstrapping with --enable-checking=no you'll get:

gcc/rust/backend/rust-compile-type.cc: In member function
‘virtual void Rust::Compile::TyTyResolveCompile::visit(const Rust::TyTy::ADTType&)’:
gcc/tree.h:2312:59: error: statement has no effect [-Werror=unused-value]
 2312 | #define TYPE_PACKED(NODE) (TYPE_CHECK (NODE)->base.u.bits.packed_flag)
      |                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
gcc/rust/backend/rust-compile-type.cc:315:7:
  note: in expansion of macro ‘TYPE_PACKED’
  315 |       TYPE_PACKED (type_record);
      |       ^~~~~~~~~~~

We need to actually set a value for the packed_flag.
---

https://code.wildebeest.org/git/user/mjw/gccrs/commit/?h=packed

 gcc/rust/backend/rust-compile-type.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/rust/backend/rust-compile-type.cc b/gcc/rust/backend/rust-compile-type.cc
index 240abe0497e..eced909673e 100644
--- a/gcc/rust/backend/rust-compile-type.cc
+++ b/gcc/rust/backend/rust-compile-type.cc
@@ -312,7 +312,7 @@ TyTyResolveCompile::visit (const TyTy::ADTType &type)
   TyTy::ADTType::ReprOptions repr = type.get_repr_options ();
   if (repr.pack)
     {
-      TYPE_PACKED (type_record);
+      TYPE_PACKED (type_record) = 1;
       if (repr.pack > 1)
 	{
 	  SET_TYPE_ALIGN (type_record, repr.pack * 8);
-- 
2.30.2



More information about the Gcc-rust mailing list