Fix an UB in layout tests

 - Replaced dereferencing of null ptr with
   zero bit pattern + transmute + std::ptr::addr_of!
   to avoid UB. It affects only checks of fields offsets
 - Overwritten expected with BINDGEN_OVERWRITE_EXPECTED=1
 - Overwritten test_multiple_header_calls_in_builder and test_mixed_header_and_header_contents
   manually because https://github.com/rust-lang/rust-bindgen/issues/2054
 - Do not check the layout for repr(C) unions
 - Do not call the destructor of tmp struct to avoid other UB
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 19886e3..3dcb50c 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -2116,8 +2116,12 @@
                         .count() >
                         1;
 
+
+                    // The offset of #[repr(C)] union is always 0, don't need to recheck it.
+                    let is_not_packed_union = is_union && !packed;
+
                     let should_skip_field_offset_checks =
-                        is_opaque || too_many_base_vtables;
+                        is_opaque || too_many_base_vtables || is_not_packed_union;
 
                     let check_field_offset = if should_skip_field_offset_checks
                     {
@@ -2137,8 +2141,24 @@
 
                                         quote! {
                                             assert_eq!(
-                                                unsafe {
-                                                    &(*(::#prefix::ptr::null::<#canonical_ident>())).#field_name as *const _ as usize
+                                                {
+                                                    // Create an instance of #canonical_ident struct from zero bit pattern
+                                                    let struct_instance = unsafe {
+                                                        std::mem::zeroed::<#canonical_ident>()
+                                                    };
+
+                                                    // Get the pointers to the struct and its field
+                                                    let struct_ptr = &struct_instance as *const #canonical_ident;
+                                                    let field_ptr = std::ptr::addr_of!(struct_instance.#field_name);
+
+                                                    // Get the offset of the field
+                                                    let struct_address =  struct_ptr as usize;
+                                                    let field_address = field_ptr as usize;
+
+                                                    //Do not call the destructor
+                                                    std::mem::forget(struct_instance);
+
+                                                    field_address.checked_sub(struct_address).unwrap()
                                                 },
                                                 #field_offset,
                                                 concat!("Offset of field: ", stringify!(#canonical_ident), "::", stringify!(#field_name))
diff --git a/tests/expectations/tests/16-byte-alignment.rs b/tests/expectations/tests/16-byte-alignment.rs
index 058568f..adc6366 100644
--- a/tests/expectations/tests/16-byte-alignment.rs
+++ b/tests/expectations/tests/16-byte-alignment.rs
@@ -43,10 +43,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .dport as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr = &struct_instance
+                as *const rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dport);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -57,10 +64,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .sport as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr = &struct_instance
+                as *const rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.sport);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -83,19 +97,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv4_tuple__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1>())).sctp_tag
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple__bindgen_ty_1),
-            "::",
-            stringify!(sctp_tag)
-        )
-    );
 }
 impl Default for rte_ipv4_tuple__bindgen_ty_1 {
     fn default() -> Self {
@@ -119,9 +120,15 @@
         concat!("Alignment of ", stringify!(rte_ipv4_tuple))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple>())).src_addr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ipv4_tuple>() };
+            let struct_ptr = &struct_instance as *const rte_ipv4_tuple;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -132,9 +139,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple>())).dst_addr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ipv4_tuple>() };
+            let struct_ptr = &struct_instance as *const rte_ipv4_tuple;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -192,10 +205,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .dport as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr = &struct_instance
+                as *const rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dport);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -206,10 +226,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .sport as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr = &struct_instance
+                as *const rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.sport);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -232,19 +259,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv6_tuple__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1>())).sctp_tag
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple__bindgen_ty_1),
-            "::",
-            stringify!(sctp_tag)
-        )
-    );
 }
 impl Default for rte_ipv6_tuple__bindgen_ty_1 {
     fn default() -> Self {
@@ -268,9 +282,15 @@
         concat!("Alignment of ", stringify!(rte_ipv6_tuple))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple>())).src_addr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ipv6_tuple>() };
+            let struct_ptr = &struct_instance as *const rte_ipv6_tuple;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -281,9 +301,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple>())).dst_addr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ipv6_tuple>() };
+            let struct_ptr = &struct_instance as *const rte_ipv6_tuple;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -322,30 +348,6 @@
         16usize,
         concat!("Alignment of ", stringify!(rte_thash_tuple))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_thash_tuple>())).v4 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_thash_tuple),
-            "::",
-            stringify!(v4)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_thash_tuple>())).v6 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_thash_tuple),
-            "::",
-            stringify!(v6)
-        )
-    );
 }
 impl Default for rte_thash_tuple {
     fn default() -> Self {
diff --git a/tests/expectations/tests/16-byte-alignment_1_0.rs b/tests/expectations/tests/16-byte-alignment_1_0.rs
index 1df6778..da4e3bf 100644
--- a/tests/expectations/tests/16-byte-alignment_1_0.rs
+++ b/tests/expectations/tests/16-byte-alignment_1_0.rs
@@ -88,10 +88,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .dport as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr = &struct_instance
+                as *const rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dport);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -102,10 +109,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .sport as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr = &struct_instance
+                as *const rte_ipv4_tuple__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.sport);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -133,19 +147,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv4_tuple__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple__bindgen_ty_1>())).sctp_tag
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv4_tuple__bindgen_ty_1),
-            "::",
-            stringify!(sctp_tag)
-        )
-    );
 }
 impl Clone for rte_ipv4_tuple__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -165,9 +166,15 @@
         concat!("Alignment of ", stringify!(rte_ipv4_tuple))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple>())).src_addr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ipv4_tuple>() };
+            let struct_ptr = &struct_instance as *const rte_ipv4_tuple;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -178,9 +185,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv4_tuple>())).dst_addr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ipv4_tuple>() };
+            let struct_ptr = &struct_instance as *const rte_ipv4_tuple;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -236,10 +249,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .dport as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr = &struct_instance
+                as *const rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dport);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -250,10 +270,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>(
-            )))
-            .sport as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr = &struct_instance
+                as *const rte_ipv6_tuple__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.sport);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -281,19 +308,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_ipv6_tuple__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple__bindgen_ty_1>())).sctp_tag
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_ipv6_tuple__bindgen_ty_1),
-            "::",
-            stringify!(sctp_tag)
-        )
-    );
 }
 impl Clone for rte_ipv6_tuple__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -313,9 +327,15 @@
         concat!("Alignment of ", stringify!(rte_ipv6_tuple))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple>())).src_addr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ipv6_tuple>() };
+            let struct_ptr = &struct_instance as *const rte_ipv6_tuple;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -326,9 +346,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ipv6_tuple>())).dst_addr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ipv6_tuple>() };
+            let struct_ptr = &struct_instance as *const rte_ipv6_tuple;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -358,30 +384,6 @@
         48usize,
         concat!("Size of: ", stringify!(rte_thash_tuple))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_thash_tuple>())).v4 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_thash_tuple),
-            "::",
-            stringify!(v4)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_thash_tuple>())).v6 as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_thash_tuple),
-            "::",
-            stringify!(v6)
-        )
-    );
 }
 impl Clone for rte_thash_tuple {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/accessors.rs b/tests/expectations/tests/accessors.rs
index 9977baa..0f2fe3f 100644
--- a/tests/expectations/tests/accessors.rs
+++ b/tests/expectations/tests/accessors.rs
@@ -29,9 +29,15 @@
         concat!("Alignment of ", stringify!(SomeAccessors))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<SomeAccessors>())).mNoAccessor as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<SomeAccessors>() };
+            let struct_ptr = &struct_instance as *const SomeAccessors;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mNoAccessor);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -42,9 +48,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<SomeAccessors>())).mBothAccessors as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<SomeAccessors>() };
+            let struct_ptr = &struct_instance as *const SomeAccessors;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBothAccessors);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -55,9 +67,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<SomeAccessors>())).mUnsafeAccessors
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<SomeAccessors>() };
+            let struct_ptr = &struct_instance as *const SomeAccessors;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mUnsafeAccessors);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -68,9 +87,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<SomeAccessors>())).mImmutableAccessor
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<SomeAccessors>() };
+            let struct_ptr = &struct_instance as *const SomeAccessors;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mImmutableAccessor);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -125,9 +151,14 @@
         concat!("Alignment of ", stringify!(AllAccessors))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllAccessors>())).mBothAccessors as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AllAccessors>() };
+            let struct_ptr = &struct_instance as *const AllAccessors;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBothAccessors);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -138,9 +169,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllAccessors>())).mAlsoBothAccessors
-                as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AllAccessors>() };
+            let struct_ptr = &struct_instance as *const AllAccessors;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mAlsoBothAccessors);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -189,9 +226,15 @@
         concat!("Alignment of ", stringify!(AllUnsafeAccessors))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllUnsafeAccessors>())).mBothAccessors
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<AllUnsafeAccessors>() };
+            let struct_ptr = &struct_instance as *const AllUnsafeAccessors;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBothAccessors);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -202,9 +245,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllUnsafeAccessors>())).mAlsoBothAccessors
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<AllUnsafeAccessors>() };
+            let struct_ptr = &struct_instance as *const AllUnsafeAccessors;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mAlsoBothAccessors);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -262,9 +312,15 @@
         concat!("Alignment of ", stringify!(ContradictAccessors))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictAccessors>())).mBothAccessors
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContradictAccessors>() };
+            let struct_ptr = &struct_instance as *const ContradictAccessors;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBothAccessors);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -275,9 +331,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictAccessors>())).mNoAccessors
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContradictAccessors>() };
+            let struct_ptr = &struct_instance as *const ContradictAccessors;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mNoAccessors);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -288,9 +350,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictAccessors>())).mUnsafeAccessors
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContradictAccessors>() };
+            let struct_ptr = &struct_instance as *const ContradictAccessors;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mUnsafeAccessors);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -301,9 +370,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictAccessors>())).mImmutableAccessor
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContradictAccessors>() };
+            let struct_ptr = &struct_instance as *const ContradictAccessors;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mImmutableAccessor);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -357,8 +433,14 @@
         concat!("Alignment of ", stringify!(Replaced))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Replaced>())).mAccessor as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Replaced>() };
+            let struct_ptr = &struct_instance as *const Replaced;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mAccessor);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -398,8 +480,14 @@
         concat!("Alignment of ", stringify!(Wrapper))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Wrapper>())).mReplaced as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Wrapper>() };
+            let struct_ptr = &struct_instance as *const Wrapper;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mReplaced);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/allowlist-namespaces.rs b/tests/expectations/tests/allowlist-namespaces.rs
index 4236f63..ab6b6cd 100644
--- a/tests/expectations/tests/allowlist-namespaces.rs
+++ b/tests/expectations/tests/allowlist-namespaces.rs
@@ -52,8 +52,14 @@
                 concat!("Alignment of ", stringify!(Test))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Test>())).helper as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+                    let struct_ptr = &struct_instance as *const Test;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.helper);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
diff --git a/tests/expectations/tests/allowlisted-item-references-no-hash.rs b/tests/expectations/tests/allowlisted-item-references-no-hash.rs
index bc3fde1..2b0b9bb 100644
--- a/tests/expectations/tests/allowlisted-item-references-no-hash.rs
+++ b/tests/expectations/tests/allowlisted-item-references-no-hash.rs
@@ -41,8 +41,14 @@
         concat!("Alignment of ", stringify!(AllowlistMe))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistMe>())).a as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AllowlistMe>() };
+            let struct_ptr = &struct_instance as *const AllowlistMe;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs b/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs
index f26f692..95771bf 100644
--- a/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs
+++ b/tests/expectations/tests/allowlisted-item-references-no-partialeq.rs
@@ -41,8 +41,14 @@
         concat!("Alignment of ", stringify!(AllowlistMe))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistMe>())).a as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AllowlistMe>() };
+            let struct_ptr = &struct_instance as *const AllowlistMe;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/allowlisted_item_references_no_copy.rs b/tests/expectations/tests/allowlisted_item_references_no_copy.rs
index a5cb17b..0e8d7c4 100644
--- a/tests/expectations/tests/allowlisted_item_references_no_copy.rs
+++ b/tests/expectations/tests/allowlisted_item_references_no_copy.rs
@@ -41,8 +41,14 @@
         concat!("Alignment of ", stringify!(AllowlistMe))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistMe>())).a as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AllowlistMe>() };
+            let struct_ptr = &struct_instance as *const AllowlistMe;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/annotation_hide.rs b/tests/expectations/tests/annotation_hide.rs
index 38435d0..57b3a8a 100644
--- a/tests/expectations/tests/annotation_hide.rs
+++ b/tests/expectations/tests/annotation_hide.rs
@@ -43,8 +43,14 @@
         concat!("Alignment of ", stringify!(NotAnnotated))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<NotAnnotated>())).f as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<NotAnnotated>() };
+            let struct_ptr = &struct_instance as *const NotAnnotated;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/anon-fields-prefix.rs b/tests/expectations/tests/anon-fields-prefix.rs
index edd551d..1b02cc8 100644
--- a/tests/expectations/tests/anon-fields-prefix.rs
+++ b/tests/expectations/tests/anon-fields-prefix.rs
@@ -32,9 +32,15 @@
         concat!("Alignment of ", stringify!(color__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_1>())).r as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<color__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const color__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.r);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -45,9 +51,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_1>())).g as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<color__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const color__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.g);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1usize,
         concat!(
@@ -58,9 +70,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_1>())).b as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<color__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const color__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -91,9 +109,15 @@
         concat!("Alignment of ", stringify!(color__bindgen_ty_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_2>())).y as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<color__bindgen_ty_2>() };
+            let struct_ptr = &struct_instance as *const color__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.y);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -104,9 +128,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_2>())).u as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<color__bindgen_ty_2>() };
+            let struct_ptr = &struct_instance as *const color__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1usize,
         concat!(
@@ -117,9 +147,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<color__bindgen_ty_2>())).v as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<color__bindgen_ty_2>() };
+            let struct_ptr = &struct_instance as *const color__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.v);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -142,11 +178,6 @@
         1usize,
         concat!("Alignment of ", stringify!(color))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<color>())).v3 as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(color), "::", stringify!(v3))
-    );
 }
 impl Default for color {
     fn default() -> Self {
diff --git a/tests/expectations/tests/anon_enum.rs b/tests/expectations/tests/anon_enum.rs
index 8cae632..52cdd21 100644
--- a/tests/expectations/tests/anon_enum.rs
+++ b/tests/expectations/tests/anon_enum.rs
@@ -30,12 +30,28 @@
         concat!("Alignment of ", stringify!(Test))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).foo as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/anon_struct_in_union.rs b/tests/expectations/tests/anon_struct_in_union.rs
index 1a40401..cc044b0 100644
--- a/tests/expectations/tests/anon_struct_in_union.rs
+++ b/tests/expectations/tests/anon_struct_in_union.rs
@@ -33,9 +33,15 @@
         concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<s__bindgen_ty_1_inner>())).b as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<s__bindgen_ty_1_inner>() };
+            let struct_ptr = &struct_instance as *const s__bindgen_ty_1_inner;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -58,19 +64,6 @@
         4usize,
         concat!("Alignment of ", stringify!(s__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<s__bindgen_ty_1>())).field as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(s__bindgen_ty_1),
-            "::",
-            stringify!(field)
-        )
-    );
 }
 impl Default for s__bindgen_ty_1 {
     fn default() -> Self {
@@ -94,7 +87,15 @@
         concat!("Alignment of ", stringify!(s))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<s>())).u as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<s>() };
+            let struct_ptr = &struct_instance as *const s;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(s), "::", stringify!(u))
     );
diff --git a/tests/expectations/tests/anon_struct_in_union_1_0.rs b/tests/expectations/tests/anon_struct_in_union_1_0.rs
index 021f414..128f081 100644
--- a/tests/expectations/tests/anon_struct_in_union_1_0.rs
+++ b/tests/expectations/tests/anon_struct_in_union_1_0.rs
@@ -77,9 +77,15 @@
         concat!("Alignment of ", stringify!(s__bindgen_ty_1_inner))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<s__bindgen_ty_1_inner>())).b as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<s__bindgen_ty_1_inner>() };
+            let struct_ptr = &struct_instance as *const s__bindgen_ty_1_inner;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -107,19 +113,6 @@
         4usize,
         concat!("Alignment of ", stringify!(s__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<s__bindgen_ty_1>())).field as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(s__bindgen_ty_1),
-            "::",
-            stringify!(field)
-        )
-    );
 }
 impl Clone for s__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -139,7 +132,15 @@
         concat!("Alignment of ", stringify!(s))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<s>())).u as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<s>() };
+            let struct_ptr = &struct_instance as *const s;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(s), "::", stringify!(u))
     );
diff --git a/tests/expectations/tests/array-of-zero-sized-types.rs b/tests/expectations/tests/array-of-zero-sized-types.rs
index 0c00cea..9f16ffb 100644
--- a/tests/expectations/tests/array-of-zero-sized-types.rs
+++ b/tests/expectations/tests/array-of-zero-sized-types.rs
@@ -44,9 +44,15 @@
         concat!("Alignment of ", stringify!(HasArrayOfEmpty))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<HasArrayOfEmpty>())).empties as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<HasArrayOfEmpty>() };
+            let struct_ptr = &struct_instance as *const HasArrayOfEmpty;
+            let field_ptr = std::ptr::addr_of!(struct_instance.empties);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/bindgen-union-inside-namespace.rs b/tests/expectations/tests/bindgen-union-inside-namespace.rs
index 6083313..2b8923a 100644
--- a/tests/expectations/tests/bindgen-union-inside-namespace.rs
+++ b/tests/expectations/tests/bindgen-union-inside-namespace.rs
@@ -77,30 +77,6 @@
                 4usize,
                 concat!("Alignment of ", stringify!(Bar))
             );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).foo as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar),
-                    "::",
-                    stringify!(foo)
-                )
-            );
-            assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).bar as *const _ as usize
-                },
-                0usize,
-                concat!(
-                    "Offset of field: ",
-                    stringify!(Bar),
-                    "::",
-                    stringify!(bar)
-                )
-            );
         }
         impl Clone for Bar {
             fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/bitfield-linux-32.rs b/tests/expectations/tests/bitfield-linux-32.rs
index 15c35ce..b70dcc1 100644
--- a/tests/expectations/tests/bitfield-linux-32.rs
+++ b/tests/expectations/tests/bitfield-linux-32.rs
@@ -111,7 +111,15 @@
         concat!("Alignment of ", stringify!(Test))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).foo as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(foo))
     );
diff --git a/tests/expectations/tests/bitfield_align.rs b/tests/expectations/tests/bitfield_align.rs
index 509981a..7d87c9e 100644
--- a/tests/expectations/tests/bitfield_align.rs
+++ b/tests/expectations/tests/bitfield_align.rs
@@ -113,12 +113,28 @@
         concat!("Alignment of ", stringify!(A))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).x as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(x))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).y as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.y);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         3usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(y))
     );
@@ -398,12 +414,28 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).x as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(x))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(baz))
     );
@@ -695,7 +727,15 @@
         concat!("Alignment of ", stringify!(Date3))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Date3>())).byte as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Date3>() };
+            let struct_ptr = &struct_instance as *const Date3;
+            let field_ptr = std::ptr::addr_of!(struct_instance.byte);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         3usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/blocklist-and-impl-debug.rs b/tests/expectations/tests/blocklist-and-impl-debug.rs
index ba39fb1..97d0a79 100644
--- a/tests/expectations/tests/blocklist-and-impl-debug.rs
+++ b/tests/expectations/tests/blocklist-and-impl-debug.rs
@@ -25,9 +25,15 @@
         concat!("Alignment of ", stringify!(ShouldManuallyImplDebug))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldManuallyImplDebug>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ShouldManuallyImplDebug>() };
+            let struct_ptr = &struct_instance as *const ShouldManuallyImplDebug;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/blocks-signature.rs b/tests/expectations/tests/blocks-signature.rs
index 22136dd..2a5b84c 100644
--- a/tests/expectations/tests/blocks-signature.rs
+++ b/tests/expectations/tests/blocks-signature.rs
@@ -48,9 +48,15 @@
         concat!("Alignment of ", stringify!(contains_block_pointers))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<contains_block_pointers>())).val as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<contains_block_pointers>() };
+            let struct_ptr = &struct_instance as *const contains_block_pointers;
+            let field_ptr = std::ptr::addr_of!(struct_instance.val);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -61,9 +67,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<contains_block_pointers>())).ptr_val
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<contains_block_pointers>() };
+            let struct_ptr = &struct_instance as *const contains_block_pointers;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ptr_val);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
diff --git a/tests/expectations/tests/blocks.rs b/tests/expectations/tests/blocks.rs
index b2ae0b2..961ec12 100644
--- a/tests/expectations/tests/blocks.rs
+++ b/tests/expectations/tests/blocks.rs
@@ -47,9 +47,15 @@
         concat!("Alignment of ", stringify!(contains_block_pointers))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<contains_block_pointers>())).val as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<contains_block_pointers>() };
+            let struct_ptr = &struct_instance as *const contains_block_pointers;
+            let field_ptr = std::ptr::addr_of!(struct_instance.val);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -60,9 +66,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<contains_block_pointers>())).ptr_val
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<contains_block_pointers>() };
+            let struct_ptr = &struct_instance as *const contains_block_pointers;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ptr_val);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
diff --git a/tests/expectations/tests/c_naming.rs b/tests/expectations/tests/c_naming.rs
index abcccf1..1a550aa 100644
--- a/tests/expectations/tests/c_naming.rs
+++ b/tests/expectations/tests/c_naming.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(struct_a))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<struct_a>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<struct_a>() };
+            let struct_ptr = &struct_instance as *const struct_a;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -52,26 +60,6 @@
         4usize,
         concat!("Alignment of ", stringify!(union_b))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<union_b>())).a as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(union_b),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<union_b>())).b as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(union_b),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for union_b {
     fn default() -> Self {
diff --git a/tests/expectations/tests/char.rs b/tests/expectations/tests/char.rs
index 1e1a198..5c2352f 100644
--- a/tests/expectations/tests/char.rs
+++ b/tests/expectations/tests/char.rs
@@ -37,52 +37,132 @@
         concat!("Alignment of ", stringify!(Test))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).ch as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).u as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         1usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).d as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         2usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cch as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         3usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cu as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cu);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cd as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         5usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cch as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Cch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         6usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cu as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Cu);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         7usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cd as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Cd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccch as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ccch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         9usize,
         concat!(
             "Offset of field: ",
@@ -92,12 +172,28 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccu as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ccu);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         10usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccd as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ccd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         11usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd))
     );
diff --git a/tests/expectations/tests/class_nested.rs b/tests/expectations/tests/class_nested.rs
index ecc5c20..5ffde3d 100644
--- a/tests/expectations/tests/class_nested.rs
+++ b/tests/expectations/tests/class_nested.rs
@@ -28,8 +28,14 @@
         concat!("Alignment of ", stringify!(A_B))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_B>())).member_b as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A_B>() };
+            let struct_ptr = &struct_instance as *const A_B;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member_b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -68,7 +74,15 @@
         concat!("Alignment of ", stringify!(A))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).member_a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member_a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -96,7 +110,15 @@
         concat!("Alignment of ", stringify!(A_C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A_C>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A_C>() };
+            let struct_ptr = &struct_instance as *const A_C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(A_C), "::", stringify!(baz))
     );
@@ -144,7 +166,15 @@
         concat!("Alignment of ", stringify!(D))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<D>())).member as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<D>() };
+            let struct_ptr = &struct_instance as *const D;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(D), "::", stringify!(member))
     );
diff --git a/tests/expectations/tests/class_no_members.rs b/tests/expectations/tests/class_no_members.rs
index 6c1e488..5a63a95 100644
--- a/tests/expectations/tests/class_no_members.rs
+++ b/tests/expectations/tests/class_no_members.rs
@@ -59,9 +59,16 @@
         concat!("Alignment of ", stringify!(whatever_child_with_member))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<whatever_child_with_member>())).m_member
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<whatever_child_with_member>() };
+            let struct_ptr =
+                &struct_instance as *const whatever_child_with_member;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m_member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/class_use_as.rs b/tests/expectations/tests/class_use_as.rs
index d6a71ac..638eb14 100644
--- a/tests/expectations/tests/class_use_as.rs
+++ b/tests/expectations/tests/class_use_as.rs
@@ -24,9 +24,14 @@
         concat!("Alignment of ", stringify!(whatever))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<whatever>())).replacement as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<whatever>() };
+            let struct_ptr = &struct_instance as *const whatever;
+            let field_ptr = std::ptr::addr_of!(struct_instance.replacement);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -55,7 +60,15 @@
         concat!("Alignment of ", stringify!(container))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<container>())).c as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<container>() };
+            let struct_ptr = &struct_instance as *const container;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/class_with_dtor.rs b/tests/expectations/tests/class_with_dtor.rs
index 0cf2d8d..08909c8 100644
--- a/tests/expectations/tests/class_with_dtor.rs
+++ b/tests/expectations/tests/class_with_dtor.rs
@@ -39,9 +39,15 @@
         concat!("Alignment of ", stringify!(WithoutDtor))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithoutDtor>())).shouldBeWithDtor as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<WithoutDtor>() };
+            let struct_ptr = &struct_instance as *const WithoutDtor;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.shouldBeWithDtor);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/class_with_inner_struct.rs b/tests/expectations/tests/class_with_inner_struct.rs
index 35ed765..73199e5 100644
--- a/tests/expectations/tests/class_with_inner_struct.rs
+++ b/tests/expectations/tests/class_with_inner_struct.rs
@@ -31,8 +31,14 @@
         concat!("Alignment of ", stringify!(A_Segment))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_Segment>())).begin as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A_Segment>() };
+            let struct_ptr = &struct_instance as *const A_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.begin);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -43,8 +49,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_Segment>())).end as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A_Segment>() };
+            let struct_ptr = &struct_instance as *const A_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.end);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -72,18 +84,6 @@
         4usize,
         concat!("Alignment of ", stringify!(A__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A__bindgen_ty_1>())).f as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A__bindgen_ty_1),
-            "::",
-            stringify!(f)
-        )
-    );
 }
 impl Default for A__bindgen_ty_1 {
     fn default() -> Self {
@@ -111,18 +111,6 @@
         4usize,
         concat!("Alignment of ", stringify!(A__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A__bindgen_ty_2>())).d as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A__bindgen_ty_2),
-            "::",
-            stringify!(d)
-        )
-    );
 }
 impl Default for A__bindgen_ty_2 {
     fn default() -> Self {
@@ -146,13 +134,27 @@
         concat!("Alignment of ", stringify!(A))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).c as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(c))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A>())).named_union as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.named_union);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -196,8 +198,14 @@
         concat!("Alignment of ", stringify!(B_Segment))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<B_Segment>())).begin as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<B_Segment>() };
+            let struct_ptr = &struct_instance as *const B_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.begin);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -208,8 +216,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<B_Segment>())).end as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<B_Segment>() };
+            let struct_ptr = &struct_instance as *const B_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.end);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -233,7 +247,15 @@
         concat!("Alignment of ", stringify!(B))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<B>())).d as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<B>() };
+            let struct_ptr = &struct_instance as *const B;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(B), "::", stringify!(d))
     );
@@ -279,9 +301,16 @@
         concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mX1
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mX1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -292,9 +321,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mY1
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mY1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -305,9 +341,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mX2
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mX2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -318,9 +361,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mY2
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mY2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -350,9 +400,16 @@
         concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_2>()))
-                .mStepSyntax as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_2>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mStepSyntax);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -363,9 +420,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_2>())).mSteps
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_2>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mSteps);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -397,19 +461,6 @@
         4usize,
         concat!("Alignment of ", stringify!(C__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1>())).mFunc as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1),
-            "::",
-            stringify!(mFunc)
-        )
-    );
 }
 impl Default for C__bindgen_ty_1 {
     fn default() -> Self {
@@ -439,8 +490,14 @@
         concat!("Alignment of ", stringify!(C_Segment))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_Segment>())).begin as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C_Segment>() };
+            let struct_ptr = &struct_instance as *const C_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.begin);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -451,8 +508,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_Segment>())).end as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C_Segment>() };
+            let struct_ptr = &struct_instance as *const C_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.end);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -476,7 +539,15 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).d as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(d))
     );
diff --git a/tests/expectations/tests/class_with_inner_struct_1_0.rs b/tests/expectations/tests/class_with_inner_struct_1_0.rs
index 52cd590..16fa86b 100644
--- a/tests/expectations/tests/class_with_inner_struct_1_0.rs
+++ b/tests/expectations/tests/class_with_inner_struct_1_0.rs
@@ -74,8 +74,14 @@
         concat!("Alignment of ", stringify!(A_Segment))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_Segment>())).begin as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A_Segment>() };
+            let struct_ptr = &struct_instance as *const A_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.begin);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -86,8 +92,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A_Segment>())).end as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A_Segment>() };
+            let struct_ptr = &struct_instance as *const A_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.end);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -121,18 +133,6 @@
         4usize,
         concat!("Alignment of ", stringify!(A__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A__bindgen_ty_1>())).f as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A__bindgen_ty_1),
-            "::",
-            stringify!(f)
-        )
-    );
 }
 impl Clone for A__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -157,18 +157,6 @@
         4usize,
         concat!("Alignment of ", stringify!(A__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A__bindgen_ty_2>())).d as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(A__bindgen_ty_2),
-            "::",
-            stringify!(d)
-        )
-    );
 }
 impl Clone for A__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -188,13 +176,27 @@
         concat!("Alignment of ", stringify!(A))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).c as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(c))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<A>())).named_union as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.named_union);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -234,8 +236,14 @@
         concat!("Alignment of ", stringify!(B_Segment))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<B_Segment>())).begin as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<B_Segment>() };
+            let struct_ptr = &struct_instance as *const B_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.begin);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -246,8 +254,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<B_Segment>())).end as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<B_Segment>() };
+            let struct_ptr = &struct_instance as *const B_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.end);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -276,7 +290,15 @@
         concat!("Alignment of ", stringify!(B))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<B>())).d as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<B>() };
+            let struct_ptr = &struct_instance as *const B;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(B), "::", stringify!(d))
     );
@@ -328,9 +350,16 @@
         concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mX1
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mX1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -341,9 +370,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mY1
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mY1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -354,9 +390,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mX2
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mX2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -367,9 +410,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_1>())).mY2
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mY2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -404,9 +454,16 @@
         concat!("Alignment of ", stringify!(C__bindgen_ty_1__bindgen_ty_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_2>()))
-                .mStepSyntax as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_2>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mStepSyntax);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -417,9 +474,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1__bindgen_ty_2>())).mSteps
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C__bindgen_ty_1__bindgen_ty_2>() };
+            let struct_ptr =
+                &struct_instance as *const C__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mSteps);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -456,19 +520,6 @@
         4usize,
         concat!("Alignment of ", stringify!(C__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C__bindgen_ty_1>())).mFunc as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(C__bindgen_ty_1),
-            "::",
-            stringify!(mFunc)
-        )
-    );
 }
 impl Clone for C__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -494,8 +545,14 @@
         concat!("Alignment of ", stringify!(C_Segment))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_Segment>())).begin as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C_Segment>() };
+            let struct_ptr = &struct_instance as *const C_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.begin);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -506,8 +563,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_Segment>())).end as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C_Segment>() };
+            let struct_ptr = &struct_instance as *const C_Segment;
+            let field_ptr = std::ptr::addr_of!(struct_instance.end);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -536,7 +599,15 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).d as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(d))
     );
diff --git a/tests/expectations/tests/class_with_typedef.rs b/tests/expectations/tests/class_with_typedef.rs
index 31faa49..20fdb97 100644
--- a/tests/expectations/tests/class_with_typedef.rs
+++ b/tests/expectations/tests/class_with_typedef.rs
@@ -30,27 +30,67 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).c as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(c))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).ptr as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ptr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(ptr))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).arr as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         16usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(arr))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).d as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         56usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(d))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).other_ptr as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.other_ptr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         64usize,
         concat!(
             "Offset of field: ",
@@ -122,7 +162,15 @@
         concat!("Alignment of ", stringify!(D))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<D>())).ptr as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<D>() };
+            let struct_ptr = &struct_instance as *const D;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ptr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         72usize,
         concat!("Offset of field: ", stringify!(D), "::", stringify!(ptr))
     );
diff --git a/tests/expectations/tests/comment-indent.rs b/tests/expectations/tests/comment-indent.rs
index c381b73..5d91150 100644
--- a/tests/expectations/tests/comment-indent.rs
+++ b/tests/expectations/tests/comment-indent.rs
@@ -81,8 +81,14 @@
                 concat!("Alignment of ", stringify!(Baz))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Baz>())).member as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Baz>() };
+                    let struct_ptr = &struct_instance as *const Baz;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.member);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
diff --git a/tests/expectations/tests/complex.rs b/tests/expectations/tests/complex.rs
index 4dae071..3c56af9 100644
--- a/tests/expectations/tests/complex.rs
+++ b/tests/expectations/tests/complex.rs
@@ -29,8 +29,14 @@
         concat!("Alignment of ", stringify!(TestDouble))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<TestDouble>())).mMember as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<TestDouble>() };
+            let struct_ptr = &struct_instance as *const TestDouble;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mMember);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -59,9 +65,15 @@
         concat!("Alignment of ", stringify!(TestDoublePtr))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<TestDoublePtr>())).mMember as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<TestDoublePtr>() };
+            let struct_ptr = &struct_instance as *const TestDoublePtr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mMember);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -99,8 +111,14 @@
         concat!("Alignment of ", stringify!(TestFloat))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<TestFloat>())).mMember as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<TestFloat>() };
+            let struct_ptr = &struct_instance as *const TestFloat;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mMember);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -129,9 +147,14 @@
         concat!("Alignment of ", stringify!(TestFloatPtr))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<TestFloatPtr>())).mMember as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<TestFloatPtr>() };
+            let struct_ptr = &struct_instance as *const TestFloatPtr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mMember);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/const-const-mut-ptr.rs b/tests/expectations/tests/const-const-mut-ptr.rs
index bc1e762..09233a5 100644
--- a/tests/expectations/tests/const-const-mut-ptr.rs
+++ b/tests/expectations/tests/const-const-mut-ptr.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/constify-all-enums.rs b/tests/expectations/tests/constify-all-enums.rs
index 78bb99f..b9e5441 100644
--- a/tests/expectations/tests/constify-all-enums.rs
+++ b/tests/expectations/tests/constify-all-enums.rs
@@ -27,9 +27,15 @@
         concat!("Alignment of ", stringify!(bar))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar>())).this_should_work as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.this_should_work);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/constify-module-enums-basic.rs b/tests/expectations/tests/constify-module-enums-basic.rs
index 59e9ba1..ee7dcad 100644
--- a/tests/expectations/tests/constify-module-enums-basic.rs
+++ b/tests/expectations/tests/constify-module-enums-basic.rs
@@ -31,9 +31,15 @@
         concat!("Alignment of ", stringify!(bar))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar>())).this_should_work as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.this_should_work);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/constify-module-enums-namespace.rs b/tests/expectations/tests/constify-module-enums-namespace.rs
index e434291..108ceb5 100644
--- a/tests/expectations/tests/constify-module-enums-namespace.rs
+++ b/tests/expectations/tests/constify-module-enums-namespace.rs
@@ -43,9 +43,17 @@
                     concat!("Alignment of ", stringify!(bar))
                 );
                 assert_eq!(
-                    unsafe {
-                        &(*(::std::ptr::null::<bar>())).this_should_work
-                            as *const _ as usize
+                    {
+                        let struct_instance =
+                            unsafe { std::mem::zeroed::<bar>() };
+                        let struct_ptr = &struct_instance as *const bar;
+                        let field_ptr = std::ptr::addr_of!(
+                            struct_instance.this_should_work
+                        );
+                        let struct_address = struct_ptr as usize;
+                        let field_address = field_ptr as usize;
+                        std::mem::forget(struct_instance);
+                        field_address.checked_sub(struct_address).unwrap()
                     },
                     0usize,
                     concat!(
diff --git a/tests/expectations/tests/constify-module-enums-shadow-name.rs b/tests/expectations/tests/constify-module-enums-shadow-name.rs
index 60401dc..4773841 100644
--- a/tests/expectations/tests/constify-module-enums-shadow-name.rs
+++ b/tests/expectations/tests/constify-module-enums-shadow-name.rs
@@ -30,7 +30,15 @@
         concat!("Alignment of ", stringify!(bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/constify-module-enums-simple-alias.rs b/tests/expectations/tests/constify-module-enums-simple-alias.rs
index 317697d..9b50334 100644
--- a/tests/expectations/tests/constify-module-enums-simple-alias.rs
+++ b/tests/expectations/tests/constify-module-enums-simple-alias.rs
@@ -39,28 +39,66 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz1 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz1))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz2 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz2))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz3 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz3);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz3))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz4 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz4);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         12usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz4))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).baz_ptr1 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz_ptr1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -71,8 +109,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).baz_ptr2 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz_ptr2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -83,8 +127,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).baz_ptr3 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz_ptr3);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -95,8 +145,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).baz_ptr4 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz_ptr4);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         40usize,
         concat!(
diff --git a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
index b664479..92fbb62 100644
--- a/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
+++ b/tests/expectations/tests/constify-module-enums-simple-nonamespace.rs
@@ -29,12 +29,28 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz1 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz1))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz2 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz2))
     );
diff --git a/tests/expectations/tests/constify-module-enums-types.rs b/tests/expectations/tests/constify-module-enums-types.rs
index ec7e6c0..1a11f1b 100644
--- a/tests/expectations/tests/constify-module-enums-types.rs
+++ b/tests/expectations/tests/constify-module-enums-types.rs
@@ -64,7 +64,15 @@
         concat!("Alignment of ", stringify!(bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member1 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -74,7 +82,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member2 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!(
             "Offset of field: ",
@@ -84,7 +100,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member3 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member3);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!(
             "Offset of field: ",
@@ -94,7 +118,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member4 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member4);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         12usize,
         concat!(
             "Offset of field: ",
@@ -104,7 +136,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member5 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member5);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         16usize,
         concat!(
             "Offset of field: ",
@@ -114,7 +154,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member6 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member6);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         24usize,
         concat!(
             "Offset of field: ",
@@ -124,7 +172,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member7 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member7);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         32usize,
         concat!(
             "Offset of field: ",
@@ -134,7 +190,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member8 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member8);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         36usize,
         concat!(
             "Offset of field: ",
@@ -144,7 +208,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).member9 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member9);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         40usize,
         concat!(
             "Offset of field: ",
@@ -154,8 +226,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar>())).member10 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member10);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         44usize,
         concat!(
@@ -193,7 +271,15 @@
         concat!("Alignment of ", stringify!(Baz))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz>())).member1 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Baz>() };
+            let struct_ptr = &struct_instance as *const Baz;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -235,7 +321,15 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz))
     );
diff --git a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs
index 2882fa8..c4ef62a 100644
--- a/tests/expectations/tests/contains-vs-inherits-zero-sized.rs
+++ b/tests/expectations/tests/contains-vs-inherits-zero-sized.rs
@@ -44,7 +44,15 @@
         concat!("Alignment of ", stringify!(Inherits))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Inherits>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Inherits>() };
+            let struct_ptr = &struct_instance as *const Inherits;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -75,8 +83,14 @@
         concat!("Alignment of ", stringify!(Contains))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Contains>())).empty as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Contains>() };
+            let struct_ptr = &struct_instance as *const Contains;
+            let field_ptr = std::ptr::addr_of!(struct_instance.empty);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -87,7 +101,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Contains>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Contains>() };
+            let struct_ptr = &struct_instance as *const Contains;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         1usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/convert-cpp-comment-to-rust.rs b/tests/expectations/tests/convert-cpp-comment-to-rust.rs
index 86279ca..50163ee 100644
--- a/tests/expectations/tests/convert-cpp-comment-to-rust.rs
+++ b/tests/expectations/tests/convert-cpp-comment-to-rust.rs
@@ -30,8 +30,14 @@
         concat!("Alignment of ", stringify!(mbedtls_mpi))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mbedtls_mpi>())).s as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<mbedtls_mpi>() };
+            let struct_ptr = &struct_instance as *const mbedtls_mpi;
+            let field_ptr = std::ptr::addr_of!(struct_instance.s);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -42,8 +48,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mbedtls_mpi>())).n as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<mbedtls_mpi>() };
+            let struct_ptr = &struct_instance as *const mbedtls_mpi;
+            let field_ptr = std::ptr::addr_of!(struct_instance.n);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -54,8 +66,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mbedtls_mpi>())).p as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<mbedtls_mpi>() };
+            let struct_ptr = &struct_instance as *const mbedtls_mpi;
+            let field_ptr = std::ptr::addr_of!(struct_instance.p);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
diff --git a/tests/expectations/tests/convert-floats.rs b/tests/expectations/tests/convert-floats.rs
index 6623159..b0c6055 100644
--- a/tests/expectations/tests/convert-floats.rs
+++ b/tests/expectations/tests/convert-floats.rs
@@ -34,22 +34,54 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(baz))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bazz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bazz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bazz))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bazzz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bazzz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         16usize,
         concat!(
             "Offset of field: ",
@@ -59,8 +91,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo>())).complexFloat as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.complexFloat);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -71,8 +109,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo>())).complexDouble as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.complexDouble);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
diff --git a/tests/expectations/tests/ctypes-prefix-path.rs b/tests/expectations/tests/ctypes-prefix-path.rs
index 12cedac..25ee0cc 100644
--- a/tests/expectations/tests/ctypes-prefix-path.rs
+++ b/tests/expectations/tests/ctypes-prefix-path.rs
@@ -32,17 +32,41 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/derive-bitfield-method-same-name.rs b/tests/expectations/tests/derive-bitfield-method-same-name.rs
index 1dc1d6e..36a736b 100644
--- a/tests/expectations/tests/derive-bitfield-method-same-name.rs
+++ b/tests/expectations/tests/derive-bitfield-method-same-name.rs
@@ -115,7 +115,15 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).large as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/derive-clone.rs b/tests/expectations/tests/derive-clone.rs
index e589a29..dfcb784 100644
--- a/tests/expectations/tests/derive-clone.rs
+++ b/tests/expectations/tests/derive-clone.rs
@@ -24,9 +24,15 @@
         concat!("Alignment of ", stringify!(ShouldDeriveClone))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDeriveClone>())).large as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ShouldDeriveClone>() };
+            let struct_ptr = &struct_instance as *const ShouldDeriveClone;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-clone_1_0.rs b/tests/expectations/tests/derive-clone_1_0.rs
index a437d5c..3b7ed5d 100644
--- a/tests/expectations/tests/derive-clone_1_0.rs
+++ b/tests/expectations/tests/derive-clone_1_0.rs
@@ -25,9 +25,15 @@
         concat!("Alignment of ", stringify!(ShouldImplClone))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldImplClone>())).large as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ShouldImplClone>() };
+            let struct_ptr = &struct_instance as *const ShouldImplClone;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-custom.rs b/tests/expectations/tests/derive-custom.rs
index 1cae9af..3aab6d9 100644
--- a/tests/expectations/tests/derive-custom.rs
+++ b/tests/expectations/tests/derive-custom.rs
@@ -24,7 +24,15 @@
         concat!("Alignment of ", stringify!(my_type))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<my_type>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<my_type>() };
+            let struct_ptr = &struct_instance as *const my_type;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -54,7 +62,15 @@
         concat!("Alignment of ", stringify!(my_type2))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<my_type2>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<my_type2>() };
+            let struct_ptr = &struct_instance as *const my_type2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -83,7 +99,15 @@
         concat!("Alignment of ", stringify!(my_type3))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<my_type3>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<my_type3>() };
+            let struct_ptr = &struct_instance as *const my_type3;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/derive-debug-bitfield-core.rs b/tests/expectations/tests/derive-debug-bitfield-core.rs
index 33f0f2f..366923e 100644
--- a/tests/expectations/tests/derive-debug-bitfield-core.rs
+++ b/tests/expectations/tests/derive-debug-bitfield-core.rs
@@ -113,8 +113,14 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<C>())).large_array as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/derive-debug-bitfield.rs b/tests/expectations/tests/derive-debug-bitfield.rs
index 00976b5..859304b 100644
--- a/tests/expectations/tests/derive-debug-bitfield.rs
+++ b/tests/expectations/tests/derive-debug-bitfield.rs
@@ -111,8 +111,14 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).large_array as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/derive-debug-function-pointer.rs b/tests/expectations/tests/derive-debug-function-pointer.rs
index c031897..472a92a 100644
--- a/tests/expectations/tests/derive-debug-function-pointer.rs
+++ b/tests/expectations/tests/derive-debug-function-pointer.rs
@@ -26,8 +26,14 @@
         concat!("Alignment of ", stringify!(Nice))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Nice>())).pointer as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Nice>() };
+            let struct_ptr = &struct_instance as *const Nice;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pointer);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -38,8 +44,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Nice>())).large_array as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Nice>() };
+            let struct_ptr = &struct_instance as *const Nice;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
diff --git a/tests/expectations/tests/derive-debug-mangle-name.rs b/tests/expectations/tests/derive-debug-mangle-name.rs
index ed54164..bbba5f7 100644
--- a/tests/expectations/tests/derive-debug-mangle-name.rs
+++ b/tests/expectations/tests/derive-debug-mangle-name.rs
@@ -30,32 +30,6 @@
         4usize,
         concat!("Alignment of ", stringify!(perf_event_attr__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<perf_event_attr__bindgen_ty_1>())).b
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(perf_event_attr__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<perf_event_attr__bindgen_ty_1>())).c
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(perf_event_attr__bindgen_ty_1),
-            "::",
-            stringify!(c)
-        )
-    );
 }
 impl Default for perf_event_attr__bindgen_ty_1 {
     fn default() -> Self {
@@ -84,9 +58,15 @@
         concat!("Alignment of ", stringify!(perf_event_attr))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<perf_event_attr>())).type_ as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<perf_event_attr>() };
+            let struct_ptr = &struct_instance as *const perf_event_attr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.type_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -97,8 +77,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<perf_event_attr>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<perf_event_attr>() };
+            let struct_ptr = &struct_instance as *const perf_event_attr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs
index ceb70ff..45db448 100644
--- a/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs
+++ b/tests/expectations/tests/derive-debug-opaque-template-instantiation.rs
@@ -22,8 +22,14 @@
         concat!("Alignment of ", stringify!(Instance))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Instance>())).val as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Instance>() };
+            let struct_ptr = &struct_instance as *const Instance;
+            let field_ptr = std::ptr::addr_of!(struct_instance.val);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-debug-opaque.rs b/tests/expectations/tests/derive-debug-opaque.rs
index 411c7a7..e5b22fa 100644
--- a/tests/expectations/tests/derive-debug-opaque.rs
+++ b/tests/expectations/tests/derive-debug-opaque.rs
@@ -54,8 +54,14 @@
         concat!("Alignment of ", stringify!(OpaqueUser))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<OpaqueUser>())).opaque as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<OpaqueUser>() };
+            let struct_ptr = &struct_instance as *const OpaqueUser;
+            let field_ptr = std::ptr::addr_of!(struct_instance.opaque);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-default-and-blocklist.rs b/tests/expectations/tests/derive-default-and-blocklist.rs
index 5d53ede..96e071e 100644
--- a/tests/expectations/tests/derive-default-and-blocklist.rs
+++ b/tests/expectations/tests/derive-default-and-blocklist.rs
@@ -26,9 +26,15 @@
         concat!("Alignment of ", stringify!(ShouldNotDeriveDefault))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDeriveDefault>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ShouldNotDeriveDefault>() };
+            let struct_ptr = &struct_instance as *const ShouldNotDeriveDefault;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-fn-ptr.rs b/tests/expectations/tests/derive-fn-ptr.rs
index 7c9f426..c54f355 100644
--- a/tests/expectations/tests/derive-fn-ptr.rs
+++ b/tests/expectations/tests/derive-fn-ptr.rs
@@ -43,8 +43,14 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Foo>())).callback as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.callback);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -89,8 +95,14 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).callback as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.callback);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-hash-and-blocklist.rs b/tests/expectations/tests/derive-hash-and-blocklist.rs
index 8e1190e..9f7a25b 100644
--- a/tests/expectations/tests/derive-hash-and-blocklist.rs
+++ b/tests/expectations/tests/derive-hash-and-blocklist.rs
@@ -25,9 +25,15 @@
         concat!("Alignment of ", stringify!(ShouldNotDeriveHash))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDeriveHash>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ShouldNotDeriveHash>() };
+            let struct_ptr = &struct_instance as *const ShouldNotDeriveHash;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-hash-blocklisting.rs b/tests/expectations/tests/derive-hash-blocklisting.rs
index 7cd29c2..a7ec958 100644
--- a/tests/expectations/tests/derive-hash-blocklisting.rs
+++ b/tests/expectations/tests/derive-hash-blocklisting.rs
@@ -31,8 +31,15 @@
         concat!("Alignment of ", stringify!(AllowlistedOne))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistedOne>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<AllowlistedOne>() };
+            let struct_ptr = &struct_instance as *const AllowlistedOne;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -70,8 +77,15 @@
         concat!("Alignment of ", stringify!(AllowlistedTwo))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AllowlistedTwo>())).b as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<AllowlistedTwo>() };
+            let struct_ptr = &struct_instance as *const AllowlistedTwo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs
index 92846f3..cbf39b8 100644
--- a/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-anon-struct-float.rs
@@ -30,8 +30,15 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -42,8 +49,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -67,7 +81,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/derive-hash-struct-with-float-array.rs b/tests/expectations/tests/derive-hash-struct-with-float-array.rs
index e2e1bcef..f21a2b4 100644
--- a/tests/expectations/tests/derive-hash-struct-with-float-array.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-float-array.rs
@@ -24,7 +24,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/derive-hash-struct-with-pointer.rs b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
index e98bbf0..5f78ec6 100644
--- a/tests/expectations/tests/derive-hash-struct-with-pointer.rs
+++ b/tests/expectations/tests/derive-hash-struct-with-pointer.rs
@@ -24,8 +24,15 @@
         concat!("Alignment of ", stringify!(ConstPtrMutObj))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ConstPtrMutObj>())).bar as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ConstPtrMutObj>() };
+            let struct_ptr = &struct_instance as *const ConstPtrMutObj;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -63,8 +70,14 @@
         concat!("Alignment of ", stringify!(MutPtrMutObj))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<MutPtrMutObj>())).bar as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<MutPtrMutObj>() };
+            let struct_ptr = &struct_instance as *const MutPtrMutObj;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -102,8 +115,15 @@
         concat!("Alignment of ", stringify!(MutPtrConstObj))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<MutPtrConstObj>())).bar as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<MutPtrConstObj>() };
+            let struct_ptr = &struct_instance as *const MutPtrConstObj;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -141,9 +161,15 @@
         concat!("Alignment of ", stringify!(ConstPtrConstObj))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ConstPtrConstObj>())).bar as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ConstPtrConstObj>() };
+            let struct_ptr = &struct_instance as *const ConstPtrConstObj;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-hash-template-inst-float.rs b/tests/expectations/tests/derive-hash-template-inst-float.rs
index f861815..e4ec39c 100644
--- a/tests/expectations/tests/derive-hash-template-inst-float.rs
+++ b/tests/expectations/tests/derive-hash-template-inst-float.rs
@@ -40,7 +40,15 @@
         concat!("Alignment of ", stringify!(IntStr))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<IntStr>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<IntStr>() };
+            let struct_ptr = &struct_instance as *const IntStr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(IntStr), "::", stringify!(a))
     );
@@ -73,7 +81,15 @@
         concat!("Alignment of ", stringify!(FloatStr))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<FloatStr>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<FloatStr>() };
+            let struct_ptr = &struct_instance as *const FloatStr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/derive-partialeq-and-blocklist.rs b/tests/expectations/tests/derive-partialeq-and-blocklist.rs
index d9dfb44..99001aa 100644
--- a/tests/expectations/tests/derive-partialeq-and-blocklist.rs
+++ b/tests/expectations/tests/derive-partialeq-and-blocklist.rs
@@ -26,9 +26,16 @@
         concat!("Alignment of ", stringify!(ShouldNotDerivePartialEq))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDerivePartialEq>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ShouldNotDerivePartialEq>() };
+            let struct_ptr =
+                &struct_instance as *const ShouldNotDerivePartialEq;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-partialeq-base.rs b/tests/expectations/tests/derive-partialeq-base.rs
index cdf8dff..75fe265 100644
--- a/tests/expectations/tests/derive-partialeq-base.rs
+++ b/tests/expectations/tests/derive-partialeq-base.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(Base))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Base>())).large as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Base>() };
+            let struct_ptr = &struct_instance as *const Base;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/derive-partialeq-bitfield.rs b/tests/expectations/tests/derive-partialeq-bitfield.rs
index cffffca..1a7c52f 100644
--- a/tests/expectations/tests/derive-partialeq-bitfield.rs
+++ b/tests/expectations/tests/derive-partialeq-bitfield.rs
@@ -111,8 +111,14 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).large_array as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/derive-partialeq-core.rs b/tests/expectations/tests/derive-partialeq-core.rs
index 8cdfb92..2079d8b 100644
--- a/tests/expectations/tests/derive-partialeq-core.rs
+++ b/tests/expectations/tests/derive-partialeq-core.rs
@@ -25,8 +25,14 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<C>())).large_array as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/derive-partialeq-pointer.rs b/tests/expectations/tests/derive-partialeq-pointer.rs
index 17a5edc..4c97a57 100644
--- a/tests/expectations/tests/derive-partialeq-pointer.rs
+++ b/tests/expectations/tests/derive-partialeq-pointer.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(b))
     );
@@ -109,7 +117,15 @@
         concat!("Alignment of ", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).d as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<a>() };
+            let struct_ptr = &struct_instance as *const a;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(a), "::", stringify!(d))
     );
diff --git a/tests/expectations/tests/derive-partialeq-union.rs b/tests/expectations/tests/derive-partialeq-union.rs
index b97c053..7150806 100644
--- a/tests/expectations/tests/derive-partialeq-union.rs
+++ b/tests/expectations/tests/derive-partialeq-union.rs
@@ -24,32 +24,6 @@
         4usize,
         concat!("Alignment of ", stringify!(ShouldNotDerivePartialEq))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDerivePartialEq>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldNotDerivePartialEq),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotDerivePartialEq>())).b as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldNotDerivePartialEq),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for ShouldNotDerivePartialEq {
     fn default() -> Self {
diff --git a/tests/expectations/tests/derive-partialeq-union_1_0.rs b/tests/expectations/tests/derive-partialeq-union_1_0.rs
index 2098849..938a30e 100644
--- a/tests/expectations/tests/derive-partialeq-union_1_0.rs
+++ b/tests/expectations/tests/derive-partialeq-union_1_0.rs
@@ -68,32 +68,6 @@
         4usize,
         concat!("Alignment of ", stringify!(ShouldDerivePartialEq))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDerivePartialEq>())).a as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldDerivePartialEq),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDerivePartialEq>())).b as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(ShouldDerivePartialEq),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Clone for ShouldDerivePartialEq {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/disable-nested-struct-naming.rs b/tests/expectations/tests/disable-nested-struct-naming.rs
index a9ad26a..bae8d3e 100644
--- a/tests/expectations/tests/disable-nested-struct-naming.rs
+++ b/tests/expectations/tests/disable-nested-struct-naming.rs
@@ -46,7 +46,15 @@
         concat!("Alignment of ", stringify!(bar4))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar4>())).x4 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar4>() };
+            let struct_ptr = &struct_instance as *const bar4;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x4);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(bar4), "::", stringify!(x4))
     );
@@ -67,9 +75,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar1__bindgen_ty_1__bindgen_ty_1>())).x3
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<bar1__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const bar1__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x3);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -80,9 +96,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar1__bindgen_ty_1__bindgen_ty_1>())).b4
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<bar1__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const bar1__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b4);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -106,9 +130,15 @@
         concat!("Alignment of ", stringify!(bar1__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar1__bindgen_ty_1>())).x2 as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<bar1__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const bar1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -119,9 +149,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<bar1__bindgen_ty_1>())).b3 as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<bar1__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const bar1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b3);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -145,12 +181,28 @@
         concat!("Alignment of ", stringify!(bar1))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar1>())).x1 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar1>() };
+            let struct_ptr = &struct_instance as *const bar1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(bar1), "::", stringify!(x1))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar1>())).b2 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar1>() };
+            let struct_ptr = &struct_instance as *const bar1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(bar1), "::", stringify!(b2))
     );
@@ -168,7 +220,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).b1 as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(b1))
     );
@@ -201,7 +261,15 @@
         concat!("Alignment of ", stringify!(baz))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<baz>())).x as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<baz>() };
+            let struct_ptr = &struct_instance as *const baz;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(baz), "::", stringify!(x))
     );
@@ -219,9 +287,16 @@
         concat!("Alignment of ", stringify!(_bindgen_ty_1__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<_bindgen_ty_1__bindgen_ty_1>())).b
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<_bindgen_ty_1__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const _bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -245,8 +320,15 @@
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<_bindgen_ty_1>())).anon2 as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<_bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const _bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.anon2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/disable-untagged-union.rs b/tests/expectations/tests/disable-untagged-union.rs
index 5300273..c6a8c51 100644
--- a/tests/expectations/tests/disable-untagged-union.rs
+++ b/tests/expectations/tests/disable-untagged-union.rs
@@ -67,14 +67,4 @@
         4usize,
         concat!("Alignment of ", stringify!(Foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).baz as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Foo), "::", stringify!(baz))
-    );
 }
diff --git a/tests/expectations/tests/do-not-derive-copy.rs b/tests/expectations/tests/do-not-derive-copy.rs
index 4112d88..d48dc97 100644
--- a/tests/expectations/tests/do-not-derive-copy.rs
+++ b/tests/expectations/tests/do-not-derive-copy.rs
@@ -26,9 +26,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WouldBeCopyButWeAreNotDerivingCopy>())).x
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<WouldBeCopyButWeAreNotDerivingCopy>()
+            };
+            let struct_ptr =
+                &struct_instance as *const WouldBeCopyButWeAreNotDerivingCopy;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/doggo-or-null.rs b/tests/expectations/tests/doggo-or-null.rs
index fa7a5e8..a2d241a 100644
--- a/tests/expectations/tests/doggo-or-null.rs
+++ b/tests/expectations/tests/doggo-or-null.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(Doggo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Doggo>())).x as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Doggo>() };
+            let struct_ptr = &struct_instance as *const Doggo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Doggo), "::", stringify!(x))
     );
diff --git a/tests/expectations/tests/duplicated-namespaces-definitions.rs b/tests/expectations/tests/duplicated-namespaces-definitions.rs
index 324fe2a..59ef176 100644
--- a/tests/expectations/tests/duplicated-namespaces-definitions.rs
+++ b/tests/expectations/tests/duplicated-namespaces-definitions.rs
@@ -31,8 +31,14 @@
                 concat!("Alignment of ", stringify!(Bar))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).foo as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+                    let struct_ptr = &struct_instance as *const Bar;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -43,8 +49,14 @@
                 )
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+                    let struct_ptr = &struct_instance as *const Bar;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 4usize,
                 concat!(
@@ -77,8 +89,14 @@
                 concat!("Alignment of ", stringify!(Foo))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Foo>())).ptr as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+                    let struct_ptr = &struct_instance as *const Foo;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.ptr);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
diff --git a/tests/expectations/tests/dynamic_loading_with_blocklist.rs b/tests/expectations/tests/dynamic_loading_with_blocklist.rs
index b06a6cf..1576f1a 100644
--- a/tests/expectations/tests/dynamic_loading_with_blocklist.rs
+++ b/tests/expectations/tests/dynamic_loading_with_blocklist.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(X))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<X>()))._x as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<X>() };
+            let struct_ptr = &struct_instance as *const X;
+            let field_ptr = std::ptr::addr_of!(struct_instance._x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(X), "::", stringify!(_x))
     );
diff --git a/tests/expectations/tests/dynamic_loading_with_class.rs b/tests/expectations/tests/dynamic_loading_with_class.rs
index 8a66dc3..5772d3a 100644
--- a/tests/expectations/tests/dynamic_loading_with_class.rs
+++ b/tests/expectations/tests/dynamic_loading_with_class.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(A))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>()))._x as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance._x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(_x))
     );
diff --git a/tests/expectations/tests/enum-default-bitfield.rs b/tests/expectations/tests/enum-default-bitfield.rs
index 1dc27fd..720f47f 100644
--- a/tests/expectations/tests/enum-default-bitfield.rs
+++ b/tests/expectations/tests/enum-default-bitfield.rs
@@ -54,7 +54,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/enum-default-consts.rs b/tests/expectations/tests/enum-default-consts.rs
index 5c023a3..65c832e 100644
--- a/tests/expectations/tests/enum-default-consts.rs
+++ b/tests/expectations/tests/enum-default-consts.rs
@@ -26,7 +26,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/enum-default-module.rs b/tests/expectations/tests/enum-default-module.rs
index 156bbca..c8fb491 100644
--- a/tests/expectations/tests/enum-default-module.rs
+++ b/tests/expectations/tests/enum-default-module.rs
@@ -28,7 +28,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/enum-default-rust.rs b/tests/expectations/tests/enum-default-rust.rs
index 045330a..a5d7ba2 100644
--- a/tests/expectations/tests/enum-default-rust.rs
+++ b/tests/expectations/tests/enum-default-rust.rs
@@ -31,7 +31,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/enum.rs b/tests/expectations/tests/enum.rs
index cc3f493..a6fdf36 100644
--- a/tests/expectations/tests/enum.rs
+++ b/tests/expectations/tests/enum.rs
@@ -26,7 +26,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).member as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/enum_and_vtable_mangling.rs b/tests/expectations/tests/enum_and_vtable_mangling.rs
index 9e9c6bc..aa3f3d9 100644
--- a/tests/expectations/tests/enum_and_vtable_mangling.rs
+++ b/tests/expectations/tests/enum_and_vtable_mangling.rs
@@ -34,7 +34,15 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).i as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(i))
     );
diff --git a/tests/expectations/tests/extern-const-struct.rs b/tests/expectations/tests/extern-const-struct.rs
index fa0018b..5646bc0 100644
--- a/tests/expectations/tests/extern-const-struct.rs
+++ b/tests/expectations/tests/extern-const-struct.rs
@@ -23,8 +23,14 @@
         concat!("Alignment of ", stringify!(nsFoo))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsFoo>())).details as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<nsFoo>() };
+            let struct_ptr = &struct_instance as *const nsFoo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.details);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/forward-declaration-autoptr.rs b/tests/expectations/tests/forward-declaration-autoptr.rs
index bf0b692..d2ab5be 100644
--- a/tests/expectations/tests/forward-declaration-autoptr.rs
+++ b/tests/expectations/tests/forward-declaration-autoptr.rs
@@ -43,8 +43,14 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Bar>())).m_member as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m_member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/forward_declared_complex_types.rs b/tests/expectations/tests/forward_declared_complex_types.rs
index e185e83..0d53ffa 100644
--- a/tests/expectations/tests/forward_declared_complex_types.rs
+++ b/tests/expectations/tests/forward_declared_complex_types.rs
@@ -46,7 +46,15 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).f as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f))
     );
diff --git a/tests/expectations/tests/forward_declared_complex_types_1_0.rs b/tests/expectations/tests/forward_declared_complex_types_1_0.rs
index c6331c6..52deea0 100644
--- a/tests/expectations/tests/forward_declared_complex_types_1_0.rs
+++ b/tests/expectations/tests/forward_declared_complex_types_1_0.rs
@@ -56,7 +56,15 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).f as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f))
     );
diff --git a/tests/expectations/tests/forward_declared_struct.rs b/tests/expectations/tests/forward_declared_struct.rs
index 2ecfc60..f31bd9e 100644
--- a/tests/expectations/tests/forward_declared_struct.rs
+++ b/tests/expectations/tests/forward_declared_struct.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<a>() };
+            let struct_ptr = &struct_instance as *const a;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
     );
@@ -46,7 +54,15 @@
         concat!("Alignment of ", stringify!(c))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<c>())).d as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<c>() };
+            let struct_ptr = &struct_instance as *const c;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(c), "::", stringify!(d))
     );
diff --git a/tests/expectations/tests/func_ptr_in_struct.rs b/tests/expectations/tests/func_ptr_in_struct.rs
index 8f98763..579f024 100644
--- a/tests/expectations/tests/func_ptr_in_struct.rs
+++ b/tests/expectations/tests/func_ptr_in_struct.rs
@@ -33,7 +33,15 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/gen-destructors-neg.rs b/tests/expectations/tests/gen-destructors-neg.rs
index 67b6d70..47576ae 100644
--- a/tests/expectations/tests/gen-destructors-neg.rs
+++ b/tests/expectations/tests/gen-destructors-neg.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/gen-destructors.rs b/tests/expectations/tests/gen-destructors.rs
index 7d96870..35adc5e 100644
--- a/tests/expectations/tests/gen-destructors.rs
+++ b/tests/expectations/tests/gen-destructors.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/i128.rs b/tests/expectations/tests/i128.rs
index 1a23969..fc3413d 100644
--- a/tests/expectations/tests/i128.rs
+++ b/tests/expectations/tests/i128.rs
@@ -25,8 +25,14 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo>())).my_signed as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.my_signed);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -37,8 +43,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo>())).my_unsigned as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.my_unsigned);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
diff --git a/tests/expectations/tests/inline_namespace.rs b/tests/expectations/tests/inline_namespace.rs
index 036d2da..3cf1e90 100644
--- a/tests/expectations/tests/inline_namespace.rs
+++ b/tests/expectations/tests/inline_namespace.rs
@@ -32,7 +32,15 @@
             concat!("Alignment of ", stringify!(Bar))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+                let struct_ptr = &struct_instance as *const Bar;
+                let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             0usize,
             concat!(
                 "Offset of field: ",
diff --git a/tests/expectations/tests/inline_namespace_conservative.rs b/tests/expectations/tests/inline_namespace_conservative.rs
index 3d2ce0c..2ef677d 100644
--- a/tests/expectations/tests/inline_namespace_conservative.rs
+++ b/tests/expectations/tests/inline_namespace_conservative.rs
@@ -37,7 +37,15 @@
             concat!("Alignment of ", stringify!(Bar))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+                let struct_ptr = &struct_instance as *const Bar;
+                let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             0usize,
             concat!(
                 "Offset of field: ",
diff --git a/tests/expectations/tests/inner_const.rs b/tests/expectations/tests/inner_const.rs
index 912ae02..21f6973 100644
--- a/tests/expectations/tests/inner_const.rs
+++ b/tests/expectations/tests/inner_const.rs
@@ -31,7 +31,15 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/inner_template_self.rs b/tests/expectations/tests/inner_template_self.rs
index 3361a1f..0f93d63 100644
--- a/tests/expectations/tests/inner_template_self.rs
+++ b/tests/expectations/tests/inner_template_self.rs
@@ -38,9 +38,15 @@
         concat!("Alignment of ", stringify!(InstantiateIt))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<InstantiateIt>())).m_list as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<InstantiateIt>() };
+            let struct_ptr = &struct_instance as *const InstantiateIt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m_list);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/issue-1118-using-forward-decl.rs b/tests/expectations/tests/issue-1118-using-forward-decl.rs
index 99f0341..77ec9e5 100644
--- a/tests/expectations/tests/issue-1118-using-forward-decl.rs
+++ b/tests/expectations/tests/issue-1118-using-forward-decl.rs
@@ -24,8 +24,15 @@
         concat!("Alignment of ", stringify!(nsTArray_base))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsTArray_base>())).d as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<nsTArray_base>() };
+            let struct_ptr = &struct_instance as *const nsTArray_base;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -77,8 +84,14 @@
         concat!("Alignment of ", stringify!(nsIContent))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsIContent>())).foo as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<nsIContent>() };
+            let struct_ptr = &struct_instance as *const nsIContent;
+            let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/issue-1216-variadic-member.rs b/tests/expectations/tests/issue-1216-variadic-member.rs
index 5bca809..08b5ee0 100644
--- a/tests/expectations/tests/issue-1216-variadic-member.rs
+++ b/tests/expectations/tests/issue-1216-variadic-member.rs
@@ -33,7 +33,15 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).f as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f))
     );
diff --git a/tests/expectations/tests/issue-1281.rs b/tests/expectations/tests/issue-1281.rs
index fe18fb1..bcaa490 100644
--- a/tests/expectations/tests/issue-1281.rs
+++ b/tests/expectations/tests/issue-1281.rs
@@ -28,7 +28,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).foo as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(foo))
     );
@@ -46,7 +54,15 @@
         concat!("Alignment of ", stringify!(bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).u as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(bar), "::", stringify!(u))
     );
@@ -70,7 +86,15 @@
         concat!("Alignment of ", stringify!(baz))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<baz>())).f as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<baz>() };
+            let struct_ptr = &struct_instance as *const baz;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(baz), "::", stringify!(f))
     );
diff --git a/tests/expectations/tests/issue-1285.rs b/tests/expectations/tests/issue-1285.rs
index 15b8c9e..99b5aba 100644
--- a/tests/expectations/tests/issue-1285.rs
+++ b/tests/expectations/tests/issue-1285.rs
@@ -28,30 +28,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -75,7 +51,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/issue-1291.rs b/tests/expectations/tests/issue-1291.rs
index 5680c34..935ba12 100644
--- a/tests/expectations/tests/issue-1291.rs
+++ b/tests/expectations/tests/issue-1291.rs
@@ -38,7 +38,15 @@
         concat!("Alignment of ", stringify!(RTCRay))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).org as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.org);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -48,8 +56,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).align0 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.align0);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -60,7 +74,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).dir as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dir);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         16usize,
         concat!(
             "Offset of field: ",
@@ -70,8 +92,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).align1 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.align1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         28usize,
         concat!(
@@ -82,8 +110,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).tnear as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tnear);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -94,7 +128,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).tfar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tfar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         36usize,
         concat!(
             "Offset of field: ",
@@ -104,7 +146,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).time as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.time);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         40usize,
         concat!(
             "Offset of field: ",
@@ -114,7 +164,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).mask as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         44usize,
         concat!(
             "Offset of field: ",
@@ -124,7 +182,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).Ng as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ng);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         48usize,
         concat!(
             "Offset of field: ",
@@ -134,8 +200,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).align2 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.align2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         60usize,
         concat!(
@@ -146,18 +218,40 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).u as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         64usize,
         concat!("Offset of field: ", stringify!(RTCRay), "::", stringify!(u))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<RTCRay>())).v as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.v);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         68usize,
         concat!("Offset of field: ", stringify!(RTCRay), "::", stringify!(v))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).geomID as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.geomID);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         72usize,
         concat!(
@@ -168,8 +262,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).primID as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.primID);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         76usize,
         concat!(
@@ -180,8 +280,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RTCRay>())).instID as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<RTCRay>() };
+            let struct_ptr = &struct_instance as *const RTCRay;
+            let field_ptr = std::ptr::addr_of!(struct_instance.instID);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         80usize,
         concat!(
diff --git a/tests/expectations/tests/issue-1382-rust-primitive-types.rs b/tests/expectations/tests/issue-1382-rust-primitive-types.rs
index 6f5aec4..4b25adc 100644
--- a/tests/expectations/tests/issue-1382-rust-primitive-types.rs
+++ b/tests/expectations/tests/issue-1382-rust-primitive-types.rs
@@ -44,47 +44,119 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i8_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i8_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i8_))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u8_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u8_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u8_))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i16_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i16_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i16_))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u16_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u16_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         12usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u16_))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i32_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i32_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         16usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i32_))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u32_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u32_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         20usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u32_))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i64_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i64_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         24usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(i64_))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u64_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u64_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         28usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(u64_))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).i128_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i128_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         32usize,
         concat!(
             "Offset of field: ",
@@ -94,7 +166,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).u128_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u128_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         36usize,
         concat!(
             "Offset of field: ",
@@ -104,7 +184,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).isize_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.isize_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         40usize,
         concat!(
             "Offset of field: ",
@@ -114,7 +202,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).usize_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.usize_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         44usize,
         concat!(
             "Offset of field: ",
@@ -124,12 +220,28 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).f32_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f32_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         48usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f32_))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).f64_ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f64_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         52usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(f64_))
     );
diff --git a/tests/expectations/tests/issue-1443.rs b/tests/expectations/tests/issue-1443.rs
index f422f4c..3e91e1e 100644
--- a/tests/expectations/tests/issue-1443.rs
+++ b/tests/expectations/tests/issue-1443.rs
@@ -29,12 +29,28 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).f as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(f))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).m as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(m))
     );
@@ -67,12 +83,28 @@
         concat!("Alignment of ", stringify!(Baz))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz>())).f as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Baz>() };
+            let struct_ptr = &struct_instance as *const Baz;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Baz), "::", stringify!(f))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz>())).m as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Baz>() };
+            let struct_ptr = &struct_instance as *const Baz;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Baz), "::", stringify!(m))
     );
@@ -105,12 +137,28 @@
         concat!("Alignment of ", stringify!(Tar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Tar>())).f as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Tar>() };
+            let struct_ptr = &struct_instance as *const Tar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Tar), "::", stringify!(f))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Tar>())).m as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Tar>() };
+            let struct_ptr = &struct_instance as *const Tar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Tar), "::", stringify!(m))
     );
@@ -143,12 +191,28 @@
         concat!("Alignment of ", stringify!(Taz))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Taz>())).f as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Taz>() };
+            let struct_ptr = &struct_instance as *const Taz;
+            let field_ptr = std::ptr::addr_of!(struct_instance.f);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Taz), "::", stringify!(f))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Taz>())).m as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Taz>() };
+            let struct_ptr = &struct_instance as *const Taz;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Taz), "::", stringify!(m))
     );
diff --git a/tests/expectations/tests/issue-1454.rs b/tests/expectations/tests/issue-1454.rs
index e88e469..83e7371 100644
--- a/tests/expectations/tests/issue-1454.rs
+++ b/tests/expectations/tests/issue-1454.rs
@@ -27,8 +27,14 @@
         concat!("Alignment of ", stringify!(local_type))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<local_type>())).inner as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<local_type>() };
+            let struct_ptr = &struct_instance as *const local_type;
+            let field_ptr = std::ptr::addr_of!(struct_instance.inner);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/issue-1498.rs b/tests/expectations/tests/issue-1498.rs
index 4f8a893..11bf3da 100644
--- a/tests/expectations/tests/issue-1498.rs
+++ b/tests/expectations/tests/issue-1498.rs
@@ -43,32 +43,6 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_memseg__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg__bindgen_ty_1>())).addr
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg__bindgen_ty_1),
-            "::",
-            stringify!(addr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg__bindgen_ty_1>())).addr_64
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_memseg__bindgen_ty_1),
-            "::",
-            stringify!(addr_64)
-        )
-    );
 }
 impl Default for rte_memseg__bindgen_ty_1 {
     fn default() -> Self {
@@ -92,9 +66,14 @@
         concat!("Alignment of ", stringify!(rte_memseg))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).phys_addr as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_memseg>() };
+            let struct_ptr = &struct_instance as *const rte_memseg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.phys_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -105,8 +84,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_memseg>() };
+            let struct_ptr = &struct_instance as *const rte_memseg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -117,9 +102,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).hugepage_sz as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_memseg>() };
+            let struct_ptr = &struct_instance as *const rte_memseg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hugepage_sz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -130,9 +120,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).socket_id as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_memseg>() };
+            let struct_ptr = &struct_instance as *const rte_memseg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.socket_id);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -143,8 +138,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).nchannel as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_memseg>() };
+            let struct_ptr = &struct_instance as *const rte_memseg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nchannel);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         36usize,
         concat!(
@@ -155,8 +156,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_memseg>())).nrank as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_memseg>() };
+            let struct_ptr = &struct_instance as *const rte_memseg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nrank);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         40usize,
         concat!(
diff --git a/tests/expectations/tests/issue-1947.rs b/tests/expectations/tests/issue-1947.rs
index 1753ef8..fabe688 100644
--- a/tests/expectations/tests/issue-1947.rs
+++ b/tests/expectations/tests/issue-1947.rs
@@ -118,8 +118,14 @@
         concat!("Alignment of ", stringify!(V56AMDY))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<V56AMDY>())).MADK as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<V56AMDY>() };
+            let struct_ptr = &struct_instance as *const V56AMDY;
+            let field_ptr = std::ptr::addr_of!(struct_instance.MADK);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -130,8 +136,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<V56AMDY>())).MABR as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<V56AMDY>() };
+            let struct_ptr = &struct_instance as *const V56AMDY;
+            let field_ptr = std::ptr::addr_of!(struct_instance.MABR);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         3usize,
         concat!(
@@ -142,8 +154,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<V56AMDY>()))._rB_ as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<V56AMDY>() };
+            let struct_ptr = &struct_instance as *const V56AMDY;
+            let field_ptr = std::ptr::addr_of!(struct_instance._rB_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         7usize,
         concat!(
diff --git a/tests/expectations/tests/issue-1995.rs b/tests/expectations/tests/issue-1995.rs
index 58e11eb..282343c 100644
--- a/tests/expectations/tests/issue-1995.rs
+++ b/tests/expectations/tests/issue-1995.rs
@@ -30,7 +30,15 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(baz))
     );
diff --git a/tests/expectations/tests/issue-2019.rs b/tests/expectations/tests/issue-2019.rs
index 383bd57..6030e07 100644
--- a/tests/expectations/tests/issue-2019.rs
+++ b/tests/expectations/tests/issue-2019.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(A))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(a))
     );
@@ -56,7 +64,15 @@
         concat!("Alignment of ", stringify!(B))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<B>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<B>() };
+            let struct_ptr = &struct_instance as *const B;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(B), "::", stringify!(b))
     );
diff --git a/tests/expectations/tests/issue-372.rs b/tests/expectations/tests/issue-372.rs
index 0cd9f7a..3df94cb 100644
--- a/tests/expectations/tests/issue-372.rs
+++ b/tests/expectations/tests/issue-372.rs
@@ -29,17 +29,41 @@
             concat!("Alignment of ", stringify!(i))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<i>())).j as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<i>() };
+                let struct_ptr = &struct_instance as *const i;
+                let field_ptr = std::ptr::addr_of!(struct_instance.j);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             0usize,
             concat!("Offset of field: ", stringify!(i), "::", stringify!(j))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<i>())).k as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<i>() };
+                let struct_ptr = &struct_instance as *const i;
+                let field_ptr = std::ptr::addr_of!(struct_instance.k);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             8usize,
             concat!("Offset of field: ", stringify!(i), "::", stringify!(k))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<i>())).l as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<i>() };
+                let struct_ptr = &struct_instance as *const i;
+                let field_ptr = std::ptr::addr_of!(struct_instance.l);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             16usize,
             concat!("Offset of field: ", stringify!(i), "::", stringify!(l))
         );
@@ -71,7 +95,15 @@
             concat!("Alignment of ", stringify!(d))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<d>())).m as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<d>() };
+                let struct_ptr = &struct_instance as *const d;
+                let field_ptr = std::ptr::addr_of!(struct_instance.m);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             0usize,
             concat!("Offset of field: ", stringify!(d), "::", stringify!(m))
         );
@@ -118,7 +150,15 @@
             concat!("Alignment of ", stringify!(F))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<F>())).w as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<F>() };
+                let struct_ptr = &struct_instance as *const F;
+                let field_ptr = std::ptr::addr_of!(struct_instance.w);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             0usize,
             concat!("Offset of field: ", stringify!(F), "::", stringify!(w))
         );
diff --git a/tests/expectations/tests/issue-537-repr-packed-n.rs b/tests/expectations/tests/issue-537-repr-packed-n.rs
index 13e1482..6e37fcd 100644
--- a/tests/expectations/tests/issue-537-repr-packed-n.rs
+++ b/tests/expectations/tests/issue-537-repr-packed-n.rs
@@ -26,8 +26,14 @@
         concat!("Alignment of ", stringify!(AlignedToOne))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AlignedToOne>())).i as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AlignedToOne>() };
+            let struct_ptr = &struct_instance as *const AlignedToOne;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -57,8 +63,14 @@
         concat!("Alignment of ", stringify!(AlignedToTwo))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AlignedToTwo>())).i as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AlignedToTwo>() };
+            let struct_ptr = &struct_instance as *const AlignedToTwo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -91,8 +103,14 @@
         concat!("Alignment of ", stringify!(PackedToOne))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToOne>())).x as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PackedToOne>() };
+            let struct_ptr = &struct_instance as *const PackedToOne;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -103,8 +121,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToOne>())).y as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PackedToOne>() };
+            let struct_ptr = &struct_instance as *const PackedToOne;
+            let field_ptr = std::ptr::addr_of!(struct_instance.y);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -135,8 +159,14 @@
         concat!("Alignment of ", stringify!(PackedToTwo))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToTwo>())).x as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PackedToTwo>() };
+            let struct_ptr = &struct_instance as *const PackedToTwo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -147,8 +177,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToTwo>())).y as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PackedToTwo>() };
+            let struct_ptr = &struct_instance as *const PackedToTwo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.y);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/issue-537.rs b/tests/expectations/tests/issue-537.rs
index e67c0e9..9b0ddac 100644
--- a/tests/expectations/tests/issue-537.rs
+++ b/tests/expectations/tests/issue-537.rs
@@ -25,8 +25,14 @@
         concat!("Alignment of ", stringify!(AlignedToOne))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AlignedToOne>())).i as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AlignedToOne>() };
+            let struct_ptr = &struct_instance as *const AlignedToOne;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -57,8 +63,14 @@
         concat!("Alignment of ", stringify!(AlignedToTwo))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AlignedToTwo>())).i as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AlignedToTwo>() };
+            let struct_ptr = &struct_instance as *const AlignedToTwo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -91,8 +103,14 @@
         concat!("Alignment of ", stringify!(PackedToOne))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToOne>())).x as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PackedToOne>() };
+            let struct_ptr = &struct_instance as *const PackedToOne;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -103,8 +121,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToOne>())).y as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PackedToOne>() };
+            let struct_ptr = &struct_instance as *const PackedToOne;
+            let field_ptr = std::ptr::addr_of!(struct_instance.y);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -137,8 +161,14 @@
         concat!("Alignment of ", stringify!(PackedToTwo))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToTwo>())).x as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PackedToTwo>() };
+            let struct_ptr = &struct_instance as *const PackedToTwo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -149,8 +179,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PackedToTwo>())).y as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PackedToTwo>() };
+            let struct_ptr = &struct_instance as *const PackedToTwo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.y);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/issue-573-layout-test-failures.rs b/tests/expectations/tests/issue-573-layout-test-failures.rs
index 871849a..2af82ca 100644
--- a/tests/expectations/tests/issue-573-layout-test-failures.rs
+++ b/tests/expectations/tests/issue-573-layout-test-failures.rs
@@ -28,8 +28,14 @@
         concat!("Alignment of ", stringify!(AutoIdVector))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<AutoIdVector>())).ar as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<AutoIdVector>() };
+            let struct_ptr = &struct_instance as *const AutoIdVector;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
index e04ff24..990d4a6 100644
--- a/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
+++ b/tests/expectations/tests/issue-574-assertion-failure-in-codegen.rs
@@ -28,8 +28,15 @@
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<_bindgen_ty_1>())).ar as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<_bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const _bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs
index 01abdcc..bd48d69 100644
--- a/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs
+++ b/tests/expectations/tests/issue-584-stylo-template-analysis-panic.rs
@@ -62,7 +62,15 @@
         concat!("Alignment of ", stringify!(g))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<g>())).h as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<g>() };
+            let struct_ptr = &struct_instance as *const g;
+            let field_ptr = std::ptr::addr_of!(struct_instance.h);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(g), "::", stringify!(h))
     );
diff --git a/tests/expectations/tests/issue-639-typedef-anon-field.rs b/tests/expectations/tests/issue-639-typedef-anon-field.rs
index 4147c1d..d3024cf 100644
--- a/tests/expectations/tests/issue-639-typedef-anon-field.rs
+++ b/tests/expectations/tests/issue-639-typedef-anon-field.rs
@@ -28,7 +28,15 @@
         concat!("Alignment of ", stringify!(Foo_Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo_Bar>())).abc as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo_Bar>() };
+            let struct_ptr = &struct_instance as *const Foo_Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.abc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -51,7 +59,15 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(bar))
     );
@@ -79,7 +95,15 @@
         concat!("Alignment of ", stringify!(Baz_Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz_Bar>())).abc as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Baz_Bar>() };
+            let struct_ptr = &struct_instance as *const Baz_Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.abc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
index 4355486..417895b 100644
--- a/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
+++ b/tests/expectations/tests/issue-648-derive-debug-with-padding.rs
@@ -26,7 +26,15 @@
         concat!("Alignment of ", stringify!(NoDebug))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoDebug>())).c as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<NoDebug>() };
+            let struct_ptr = &struct_instance as *const NoDebug;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -74,9 +82,16 @@
         concat!("Alignment of ", stringify!(ShouldDeriveDebugButDoesNot))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDeriveDebugButDoesNot>())).c
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ShouldDeriveDebugButDoesNot>() };
+            let struct_ptr =
+                &struct_instance as *const ShouldDeriveDebugButDoesNot;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -87,9 +102,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldDeriveDebugButDoesNot>())).d
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ShouldDeriveDebugButDoesNot>() };
+            let struct_ptr =
+                &struct_instance as *const ShouldDeriveDebugButDoesNot;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
diff --git a/tests/expectations/tests/issue-674-1.rs b/tests/expectations/tests/issue-674-1.rs
index 5ad6694..e35c32c 100644
--- a/tests/expectations/tests/issue-674-1.rs
+++ b/tests/expectations/tests/issue-674-1.rs
@@ -37,9 +37,16 @@
             concat!("Alignment of ", stringify!(CapturingContentInfo))
         );
         assert_eq!(
-            unsafe {
-                &(*(::std::ptr::null::<CapturingContentInfo>())).a as *const _
-                    as usize
+            {
+                let struct_instance =
+                    unsafe { std::mem::zeroed::<CapturingContentInfo>() };
+                let struct_ptr =
+                    &struct_instance as *const CapturingContentInfo;
+                let field_ptr = std::ptr::addr_of!(struct_instance.a);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
             },
             0usize,
             concat!(
diff --git a/tests/expectations/tests/issue-674-2.rs b/tests/expectations/tests/issue-674-2.rs
index 4ccc450..71b3aac 100644
--- a/tests/expectations/tests/issue-674-2.rs
+++ b/tests/expectations/tests/issue-674-2.rs
@@ -37,7 +37,15 @@
             concat!("Alignment of ", stringify!(c))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<c>())).b as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<c>() };
+                let struct_ptr = &struct_instance as *const c;
+                let field_ptr = std::ptr::addr_of!(struct_instance.b);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             0usize,
             concat!("Offset of field: ", stringify!(c), "::", stringify!(b))
         );
@@ -60,7 +68,15 @@
             concat!("Alignment of ", stringify!(B))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<B>())).a as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<B>() };
+                let struct_ptr = &struct_instance as *const B;
+                let field_ptr = std::ptr::addr_of!(struct_instance.a);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             0usize,
             concat!("Offset of field: ", stringify!(B), "::", stringify!(a))
         );
diff --git a/tests/expectations/tests/issue-674-3.rs b/tests/expectations/tests/issue-674-3.rs
index 99c96b9..3261a8e 100644
--- a/tests/expectations/tests/issue-674-3.rs
+++ b/tests/expectations/tests/issue-674-3.rs
@@ -33,7 +33,15 @@
             concat!("Alignment of ", stringify!(a))
         );
         assert_eq!(
-            unsafe { &(*(::std::ptr::null::<a>())).b as *const _ as usize },
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<a>() };
+                let struct_ptr = &struct_instance as *const a;
+                let field_ptr = std::ptr::addr_of!(struct_instance.b);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
+            },
             0usize,
             concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
         );
@@ -56,8 +64,15 @@
             concat!("Alignment of ", stringify!(nsCSSValue))
         );
         assert_eq!(
-            unsafe {
-                &(*(::std::ptr::null::<nsCSSValue>())).c as *const _ as usize
+            {
+                let struct_instance =
+                    unsafe { std::mem::zeroed::<nsCSSValue>() };
+                let struct_ptr = &struct_instance as *const nsCSSValue;
+                let field_ptr = std::ptr::addr_of!(struct_instance.c);
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
             },
             0usize,
             concat!(
diff --git a/tests/expectations/tests/issue-801-opaque-sloppiness.rs b/tests/expectations/tests/issue-801-opaque-sloppiness.rs
index 6fe3cc6..42704d0 100644
--- a/tests/expectations/tests/issue-801-opaque-sloppiness.rs
+++ b/tests/expectations/tests/issue-801-opaque-sloppiness.rs
@@ -51,7 +51,15 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(b))
     );
diff --git a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs
index 7fd9caa..c4273f0 100644
--- a/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs
+++ b/tests/expectations/tests/issue-807-opaque-types-methods-being-generated.rs
@@ -120,9 +120,14 @@
         concat!("Alignment of ", stringify!(Allowlisted))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Allowlisted>())).some_member as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Allowlisted>() };
+            let struct_ptr = &struct_instance as *const Allowlisted;
+            let field_ptr = std::ptr::addr_of!(struct_instance.some_member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs b/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs
index dc50fe1..6254fef 100644
--- a/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs
+++ b/tests/expectations/tests/issue-944-derive-copy-and-blocklisting.rs
@@ -25,8 +25,15 @@
         concat!("Alignment of ", stringify!(ShouldNotBeCopy))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ShouldNotBeCopy>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ShouldNotBeCopy>() };
+            let struct_ptr = &struct_instance as *const ShouldNotBeCopy;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/jsval_layout_opaque.rs b/tests/expectations/tests/jsval_layout_opaque.rs
index 5b84279..7c589dd 100644
--- a/tests/expectations/tests/jsval_layout_opaque.rs
+++ b/tests/expectations/tests/jsval_layout_opaque.rs
@@ -293,45 +293,6 @@
             stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .i32_ as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(i32_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .u32_ as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(u32_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .why as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(why)
-        )
-    );
 }
 impl Default for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
     fn default() -> Self {
@@ -355,9 +316,16 @@
         concat!("Alignment of ", stringify!(jsval_layout__bindgen_ty_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2>())).payload
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<jsval_layout__bindgen_ty_2>() };
+            let struct_ptr =
+                &struct_instance as *const jsval_layout__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.payload);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -389,93 +357,6 @@
         8usize,
         concat!("Alignment of ", stringify!(jsval_layout))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asBits as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asBits)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).debugView as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(debugView)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).s as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(s)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asDouble as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asDouble)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asPtr as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asPtr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asWord as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asWord)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asUIntPtr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asUIntPtr)
-        )
-    );
 }
 impl Default for jsval_layout {
     fn default() -> Self {
@@ -504,7 +385,15 @@
         concat!("Alignment of ", stringify!(Value))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Value>())).data as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Value>() };
+            let struct_ptr = &struct_instance as *const Value;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/jsval_layout_opaque_1_0.rs b/tests/expectations/tests/jsval_layout_opaque_1_0.rs
index 260282d..02964ad 100644
--- a/tests/expectations/tests/jsval_layout_opaque_1_0.rs
+++ b/tests/expectations/tests/jsval_layout_opaque_1_0.rs
@@ -343,45 +343,6 @@
             stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .i32_ as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(i32_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .u32_ as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(u32_)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2__bindgen_ty_1>()))
-                .why as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout__bindgen_ty_2__bindgen_ty_1),
-            "::",
-            stringify!(why)
-        )
-    );
 }
 impl Clone for jsval_layout__bindgen_ty_2__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -401,9 +362,16 @@
         concat!("Alignment of ", stringify!(jsval_layout__bindgen_ty_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout__bindgen_ty_2>())).payload
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<jsval_layout__bindgen_ty_2>() };
+            let struct_ptr =
+                &struct_instance as *const jsval_layout__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.payload);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -431,93 +399,6 @@
         8usize,
         concat!("Alignment of ", stringify!(jsval_layout))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asBits as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asBits)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).debugView as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(debugView)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).s as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(s)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asDouble as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asDouble)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asPtr as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asPtr)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asWord as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asWord)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<jsval_layout>())).asUIntPtr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(jsval_layout),
-            "::",
-            stringify!(asUIntPtr)
-        )
-    );
 }
 impl Clone for jsval_layout {
     fn clone(&self) -> Self {
@@ -542,7 +423,15 @@
         concat!("Alignment of ", stringify!(Value))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Value>())).data as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Value>() };
+            let struct_ptr = &struct_instance as *const Value;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/layout_arp.rs b/tests/expectations/tests/layout_arp.rs
index d6642d7..dd00c7d 100644
--- a/tests/expectations/tests/layout_arp.rs
+++ b/tests/expectations/tests/layout_arp.rs
@@ -41,9 +41,14 @@
         concat!("Alignment of ", stringify!(ether_addr))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ether_addr>())).addr_bytes as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ether_addr>() };
+            let struct_ptr = &struct_instance as *const ether_addr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.addr_bytes);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -80,8 +85,14 @@
         concat!("Alignment of ", stringify!(arp_ipv4))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_ipv4>())).arp_sha as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_ipv4>() };
+            let struct_ptr = &struct_instance as *const arp_ipv4;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_sha);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -92,8 +103,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_ipv4>())).arp_sip as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_ipv4>() };
+            let struct_ptr = &struct_instance as *const arp_ipv4;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_sip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         6usize,
         concat!(
@@ -104,8 +121,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_ipv4>())).arp_tha as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_ipv4>() };
+            let struct_ptr = &struct_instance as *const arp_ipv4;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_tha);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         10usize,
         concat!(
@@ -116,8 +139,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_ipv4>())).arp_tip as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_ipv4>() };
+            let struct_ptr = &struct_instance as *const arp_ipv4;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_tip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -152,8 +181,14 @@
         concat!("Alignment of ", stringify!(arp_hdr))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_hrd as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_hdr>() };
+            let struct_ptr = &struct_instance as *const arp_hdr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_hrd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -164,8 +199,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_pro as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_hdr>() };
+            let struct_ptr = &struct_instance as *const arp_hdr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_pro);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -176,8 +217,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_hln as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_hdr>() };
+            let struct_ptr = &struct_instance as *const arp_hdr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_hln);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -188,8 +235,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_pln as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_hdr>() };
+            let struct_ptr = &struct_instance as *const arp_hdr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_pln);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         5usize,
         concat!(
@@ -200,8 +253,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_op as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_hdr>() };
+            let struct_ptr = &struct_instance as *const arp_hdr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_op);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         6usize,
         concat!(
@@ -212,8 +271,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<arp_hdr>())).arp_data as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<arp_hdr>() };
+            let struct_ptr = &struct_instance as *const arp_hdr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arp_data);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
diff --git a/tests/expectations/tests/layout_array.rs b/tests/expectations/tests/layout_array.rs
index 3ba1b6d..39d157f 100644
--- a/tests/expectations/tests/layout_array.rs
+++ b/tests/expectations/tests/layout_array.rs
@@ -80,9 +80,15 @@
         concat!("Alignment of ", stringify!(rte_mempool_ops))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).name as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_mempool_ops>() };
+            let struct_ptr = &struct_instance as *const rte_mempool_ops;
+            let field_ptr = std::ptr::addr_of!(struct_instance.name);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -93,9 +99,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).alloc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_mempool_ops>() };
+            let struct_ptr = &struct_instance as *const rte_mempool_ops;
+            let field_ptr = std::ptr::addr_of!(struct_instance.alloc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -106,9 +118,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).free as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_mempool_ops>() };
+            let struct_ptr = &struct_instance as *const rte_mempool_ops;
+            let field_ptr = std::ptr::addr_of!(struct_instance.free);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         40usize,
         concat!(
@@ -119,9 +137,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).enqueue as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_mempool_ops>() };
+            let struct_ptr = &struct_instance as *const rte_mempool_ops;
+            let field_ptr = std::ptr::addr_of!(struct_instance.enqueue);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         48usize,
         concat!(
@@ -132,9 +156,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).dequeue as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_mempool_ops>() };
+            let struct_ptr = &struct_instance as *const rte_mempool_ops;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dequeue);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         56usize,
         concat!(
@@ -145,9 +175,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops>())).get_count as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_mempool_ops>() };
+            let struct_ptr = &struct_instance as *const rte_mempool_ops;
+            let field_ptr = std::ptr::addr_of!(struct_instance.get_count);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -197,9 +233,15 @@
         concat!("Alignment of ", stringify!(rte_spinlock_t))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_spinlock_t>())).locked as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_spinlock_t>() };
+            let struct_ptr = &struct_instance as *const rte_spinlock_t;
+            let field_ptr = std::ptr::addr_of!(struct_instance.locked);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -242,9 +284,15 @@
         concat!("Alignment of ", stringify!(rte_mempool_ops_table))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops_table>())).sl as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_mempool_ops_table>() };
+            let struct_ptr = &struct_instance as *const rte_mempool_ops_table;
+            let field_ptr = std::ptr::addr_of!(struct_instance.sl);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -255,9 +303,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops_table>())).num_ops
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_mempool_ops_table>() };
+            let struct_ptr = &struct_instance as *const rte_mempool_ops_table;
+            let field_ptr = std::ptr::addr_of!(struct_instance.num_ops);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -268,9 +322,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mempool_ops_table>())).ops as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_mempool_ops_table>() };
+            let struct_ptr = &struct_instance as *const rte_mempool_ops_table;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ops);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -318,9 +378,16 @@
         concat!("Alignment of ", stringify!(malloc_heap__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap__bindgen_ty_1>())).lh_first
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<malloc_heap__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const malloc_heap__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lh_first);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -353,8 +420,14 @@
         concat!("Alignment of ", stringify!(malloc_heap))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap>())).lock as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<malloc_heap>() };
+            let struct_ptr = &struct_instance as *const malloc_heap;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lock);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -365,9 +438,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap>())).free_head as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<malloc_heap>() };
+            let struct_ptr = &struct_instance as *const malloc_heap;
+            let field_ptr = std::ptr::addr_of!(struct_instance.free_head);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -378,9 +456,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap>())).alloc_count as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<malloc_heap>() };
+            let struct_ptr = &struct_instance as *const malloc_heap;
+            let field_ptr = std::ptr::addr_of!(struct_instance.alloc_count);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         112usize,
         concat!(
@@ -391,9 +474,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<malloc_heap>())).total_size as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<malloc_heap>() };
+            let struct_ptr = &struct_instance as *const malloc_heap;
+            let field_ptr = std::ptr::addr_of!(struct_instance.total_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         120usize,
         concat!(
diff --git a/tests/expectations/tests/layout_array_too_long.rs b/tests/expectations/tests/layout_array_too_long.rs
index c9880ea..51620a1 100644
--- a/tests/expectations/tests/layout_array_too_long.rs
+++ b/tests/expectations/tests/layout_array_too_long.rs
@@ -46,7 +46,15 @@
         concat!("Alignment of ", stringify!(ip_frag))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).ofs as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag>() };
+            let struct_ptr = &struct_instance as *const ip_frag;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ofs);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -56,7 +64,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).len as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag>() };
+            let struct_ptr = &struct_instance as *const ip_frag;
+            let field_ptr = std::ptr::addr_of!(struct_instance.len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         2usize,
         concat!(
             "Offset of field: ",
@@ -66,7 +82,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).mb as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag>() };
+            let struct_ptr = &struct_instance as *const ip_frag;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mb);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!(
             "Offset of field: ",
@@ -109,8 +133,14 @@
         concat!("Alignment of ", stringify!(ip_frag_key))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).src_dst as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_key>() };
+            let struct_ptr = &struct_instance as *const ip_frag_key;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_dst);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -121,8 +151,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).id as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_key>() };
+            let struct_ptr = &struct_instance as *const ip_frag_key;
+            let field_ptr = std::ptr::addr_of!(struct_instance.id);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -133,8 +169,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).key_len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_key>() };
+            let struct_ptr = &struct_instance as *const ip_frag_key;
+            let field_ptr = std::ptr::addr_of!(struct_instance.key_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         36usize,
         concat!(
@@ -185,9 +227,16 @@
         concat!("Alignment of ", stringify!(ip_frag_pkt__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt__bindgen_ty_1>())).tqe_next
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_pkt__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const ip_frag_pkt__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tqe_next);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -198,9 +247,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt__bindgen_ty_1>())).tqe_prev
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_pkt__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const ip_frag_pkt__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tqe_prev);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -233,8 +289,14 @@
         concat!("Alignment of ", stringify!(ip_frag_pkt))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).lru as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lru);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -245,8 +307,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).key as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.key);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -257,8 +325,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).start as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.start);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         56usize,
         concat!(
@@ -269,9 +343,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).total_size as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.total_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -282,9 +361,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).frag_size as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.frag_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         68usize,
         concat!(
@@ -295,9 +379,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).last_idx as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.last_idx);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         72usize,
         concat!(
@@ -308,8 +397,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).frags as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.frags);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         80usize,
         concat!(
diff --git a/tests/expectations/tests/layout_cmdline_token.rs b/tests/expectations/tests/layout_cmdline_token.rs
index 47170dd..0c916f9 100644
--- a/tests/expectations/tests/layout_cmdline_token.rs
+++ b/tests/expectations/tests/layout_cmdline_token.rs
@@ -26,9 +26,15 @@
         concat!("Alignment of ", stringify!(cmdline_token_hdr))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_hdr>())).ops as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<cmdline_token_hdr>() };
+            let struct_ptr = &struct_instance as *const cmdline_token_hdr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ops);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -39,9 +45,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_hdr>())).offset as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<cmdline_token_hdr>() };
+            let struct_ptr = &struct_instance as *const cmdline_token_hdr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.offset);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -130,9 +142,15 @@
         concat!("Alignment of ", stringify!(cmdline_token_ops))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_ops>())).parse as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<cmdline_token_ops>() };
+            let struct_ptr = &struct_instance as *const cmdline_token_ops;
+            let field_ptr = std::ptr::addr_of!(struct_instance.parse);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -143,9 +161,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_ops>())).complete_get_nb
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<cmdline_token_ops>() };
+            let struct_ptr = &struct_instance as *const cmdline_token_ops;
+            let field_ptr = std::ptr::addr_of!(struct_instance.complete_get_nb);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -156,9 +180,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_ops>())).complete_get_elt
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<cmdline_token_ops>() };
+            let struct_ptr = &struct_instance as *const cmdline_token_ops;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.complete_get_elt);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -169,9 +200,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_ops>())).get_help as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<cmdline_token_ops>() };
+            let struct_ptr = &struct_instance as *const cmdline_token_ops;
+            let field_ptr = std::ptr::addr_of!(struct_instance.get_help);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -212,9 +249,15 @@
         concat!("Alignment of ", stringify!(cmdline_token_num_data))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_num_data>())).type_ as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<cmdline_token_num_data>() };
+            let struct_ptr = &struct_instance as *const cmdline_token_num_data;
+            let field_ptr = std::ptr::addr_of!(struct_instance.type_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -253,9 +296,15 @@
         concat!("Alignment of ", stringify!(cmdline_token_num))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_num>())).hdr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<cmdline_token_num>() };
+            let struct_ptr = &struct_instance as *const cmdline_token_num;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hdr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -266,9 +315,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<cmdline_token_num>())).num_data as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<cmdline_token_num>() };
+            let struct_ptr = &struct_instance as *const cmdline_token_num;
+            let field_ptr = std::ptr::addr_of!(struct_instance.num_data);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
diff --git a/tests/expectations/tests/layout_eth_conf.rs b/tests/expectations/tests/layout_eth_conf.rs
index e880608..1b941b9 100644
--- a/tests/expectations/tests/layout_eth_conf.rs
+++ b/tests/expectations/tests/layout_eth_conf.rs
@@ -171,9 +171,15 @@
         concat!("Alignment of ", stringify!(rte_eth_rxmode))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).mq_mode as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rxmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rxmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mq_mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -184,9 +190,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).max_rx_pkt_len
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rxmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rxmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.max_rx_pkt_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -197,9 +209,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).split_hdr_size
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rxmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rxmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.split_hdr_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -436,9 +454,15 @@
         concat!("Alignment of ", stringify!(rte_eth_txmode))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_txmode>())).mq_mode as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_txmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_txmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mq_mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -449,8 +473,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_txmode>())).pvid as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_txmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_txmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pvid);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -574,9 +605,15 @@
         concat!("Alignment of ", stringify!(rte_eth_rss_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_key as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rss_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rss_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rss_key);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -587,9 +624,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_key_len as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rss_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rss_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rss_key_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -600,9 +643,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_hf as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rss_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rss_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rss_hf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -694,9 +743,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()))
-                .vlan_id as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_dcb_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_id);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -707,9 +764,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()))
-                .pools as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_dcb_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -733,9 +798,15 @@
         concat!("Alignment of ", stringify!(rte_eth_vmdq_dcb_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).nb_queue_pools
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_queue_pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -746,9 +817,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>()))
-                .enable_default_pool as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.enable_default_pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -759,9 +837,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).default_pool
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.default_pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         5usize,
         concat!(
@@ -772,9 +856,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).nb_pool_maps
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_pool_maps);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         6usize,
         concat!(
@@ -785,9 +875,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).pool_map
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pool_map);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -798,9 +894,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).dcb_tc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1032usize,
         concat!(
@@ -841,9 +943,15 @@
         concat!("Alignment of ", stringify!(rte_eth_dcb_rx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_rx_conf>())).nb_tcs as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_dcb_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_dcb_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_tcs);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -854,9 +962,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_rx_conf>())).dcb_tc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_dcb_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_dcb_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -897,9 +1011,16 @@
         concat!("Alignment of ", stringify!(rte_eth_vmdq_dcb_tx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_tx_conf>())).nb_queue_pools
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_tx_conf>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_dcb_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_queue_pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -910,9 +1031,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_tx_conf>())).dcb_tc
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_tx_conf>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_dcb_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -953,9 +1081,15 @@
         concat!("Alignment of ", stringify!(rte_eth_dcb_tx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_tx_conf>())).nb_tcs as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_dcb_tx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_dcb_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_tcs);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -966,9 +1100,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_tx_conf>())).dcb_tc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_dcb_tx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_dcb_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1007,9 +1147,15 @@
         concat!("Alignment of ", stringify!(rte_eth_vmdq_tx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_tx_conf>())).nb_queue_pools
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_tx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_queue_pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1071,9 +1217,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf__bindgen_ty_1>()))
-                .vlan_id as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_eth_vmdq_rx_conf__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_rx_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_id);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1084,9 +1238,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf__bindgen_ty_1>())).pools
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_eth_vmdq_rx_conf__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_rx_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -1110,9 +1272,15 @@
         concat!("Alignment of ", stringify!(rte_eth_vmdq_rx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).nb_queue_pools
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_queue_pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1123,9 +1291,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).enable_default_pool
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.enable_default_pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1136,9 +1311,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).default_pool
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.default_pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         5usize,
         concat!(
@@ -1149,9 +1330,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).enable_loop_back
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.enable_loop_back);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         6usize,
         concat!(
@@ -1162,9 +1350,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).nb_pool_maps
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_pool_maps);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         7usize,
         concat!(
@@ -1175,9 +1369,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).rx_mode as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rx_mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -1188,9 +1388,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).pool_map
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pool_map);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1276,9 +1482,15 @@
         concat!("Alignment of ", stringify!(rte_eth_ipv4_flow))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).src_ip as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_ip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1289,9 +1501,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).dst_ip as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_ip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1302,9 +1520,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).tos as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tos);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -1315,9 +1539,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).ttl as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ttl);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         9usize,
         concat!(
@@ -1328,9 +1558,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).proto as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.proto);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         10usize,
         concat!(
@@ -1369,9 +1605,15 @@
         concat!("Alignment of ", stringify!(rte_eth_ipv6_flow))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).src_ip as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_ip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1382,9 +1624,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).dst_ip as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_ip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1395,9 +1643,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).tc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -1408,9 +1662,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).proto as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.proto);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         33usize,
         concat!(
@@ -1421,9 +1681,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).hop_limits as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hop_limits);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         34usize,
         concat!(
@@ -1471,9 +1737,15 @@
         concat!("Alignment of ", stringify!(rte_eth_fdir_masks))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).vlan_tci_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_tci_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1484,9 +1756,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).ipv4_mask as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ipv4_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1497,9 +1775,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).ipv6_mask as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ipv6_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1510,9 +1794,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).src_port_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_port_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         52usize,
         concat!(
@@ -1523,9 +1813,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).dst_port_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_port_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         54usize,
         concat!(
@@ -1536,9 +1832,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).mac_addr_byte_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mac_addr_byte_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         56usize,
         concat!(
@@ -1549,9 +1852,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).tunnel_id_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tunnel_id_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         60usize,
         concat!(
@@ -1562,9 +1871,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).tunnel_type_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.tunnel_type_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -1608,9 +1924,16 @@
         concat!("Alignment of ", stringify!(rte_eth_flex_payload_cfg))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_flex_payload_cfg>())).type_
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_flex_payload_cfg>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_flex_payload_cfg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.type_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1621,9 +1944,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_flex_payload_cfg>())).src_offset
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_flex_payload_cfg>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_flex_payload_cfg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_offset);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1664,9 +1994,15 @@
         concat!("Alignment of ", stringify!(rte_eth_fdir_flex_mask))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_mask>())).flow_type
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_mask>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_mask;
+            let field_ptr = std::ptr::addr_of!(struct_instance.flow_type);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1677,9 +2013,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_mask>())).mask as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_mask>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_mask;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -1715,9 +2057,15 @@
         concat!("Alignment of ", stringify!(rte_eth_fdir_flex_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).nb_payloads
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_payloads);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1728,9 +2076,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).nb_flexmasks
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_flexmasks);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -1741,9 +2095,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).flex_set
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.flex_set);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1754,9 +2114,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).flex_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.flex_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         292usize,
         concat!(
@@ -1807,8 +2173,15 @@
         concat!("Alignment of ", stringify!(rte_fdir_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).mode as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1819,9 +2192,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).pballoc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pballoc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1832,9 +2211,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).status as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.status);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -1845,9 +2230,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).drop_queue as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.drop_queue);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -1858,8 +2249,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).mask as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1870,9 +2268,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).flex_conf as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.flex_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         84usize,
         concat!(
@@ -1914,8 +2318,15 @@
         concat!("Alignment of ", stringify!(rte_intr_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_intr_conf>())).lsc as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_intr_conf>() };
+            let struct_ptr = &struct_instance as *const rte_intr_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lsc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1926,8 +2337,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_intr_conf>())).rxq as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_intr_conf>() };
+            let struct_ptr = &struct_instance as *const rte_intr_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rxq);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -1996,9 +2414,16 @@
         concat!("Alignment of ", stringify!(rte_eth_conf__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).rss_conf
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_conf__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rss_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -2009,9 +2434,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).vmdq_dcb_conf
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_conf__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vmdq_dcb_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -2022,9 +2454,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).dcb_rx_conf
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_conf__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_rx_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1064usize,
         concat!(
@@ -2035,9 +2474,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).vmdq_rx_conf
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_conf__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vmdq_rx_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1080usize,
         concat!(
@@ -2076,45 +2522,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_conf__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>()))
-                .vmdq_dcb_tx_conf as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(vmdq_dcb_tx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>())).dcb_tx_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(dcb_tx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>())).vmdq_tx_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(vmdq_tx_conf)
-        )
-    );
 }
 impl Default for rte_eth_conf__bindgen_ty_2 {
     fn default() -> Self {
@@ -2138,9 +2545,14 @@
         concat!("Alignment of ", stringify!(rte_eth_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).link_speeds as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.link_speeds);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -2151,8 +2563,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).rxmode as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rxmode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -2163,8 +2581,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).txmode as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.txmode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -2175,9 +2599,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).lpbk_mode as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lpbk_mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -2188,9 +2617,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).rx_adv_conf as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rx_adv_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -2201,9 +2635,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).tx_adv_conf as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tx_adv_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2152usize,
         concat!(
@@ -2214,9 +2653,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).dcb_capability_en
-                as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.dcb_capability_en);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2164usize,
         concat!(
@@ -2227,9 +2672,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).fdir_conf as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.fdir_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2168usize,
         concat!(
@@ -2240,9 +2690,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).intr_conf as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.intr_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2940usize,
         concat!(
diff --git a/tests/expectations/tests/layout_eth_conf_1_0.rs b/tests/expectations/tests/layout_eth_conf_1_0.rs
index fde1c67..59a355b 100644
--- a/tests/expectations/tests/layout_eth_conf_1_0.rs
+++ b/tests/expectations/tests/layout_eth_conf_1_0.rs
@@ -214,9 +214,15 @@
         concat!("Alignment of ", stringify!(rte_eth_rxmode))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).mq_mode as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rxmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rxmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mq_mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -227,9 +233,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).max_rx_pkt_len
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rxmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rxmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.max_rx_pkt_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -240,9 +252,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rxmode>())).split_hdr_size
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rxmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rxmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.split_hdr_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -484,9 +502,15 @@
         concat!("Alignment of ", stringify!(rte_eth_txmode))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_txmode>())).mq_mode as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_txmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_txmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mq_mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -497,8 +521,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_txmode>())).pvid as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_txmode>() };
+            let struct_ptr = &struct_instance as *const rte_eth_txmode;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pvid);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -627,9 +658,15 @@
         concat!("Alignment of ", stringify!(rte_eth_rss_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_key as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rss_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rss_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rss_key);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -640,9 +677,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_key_len as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rss_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rss_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rss_key_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -653,9 +696,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_rss_conf>())).rss_hf as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_rss_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_rss_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rss_hf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -752,9 +801,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()))
-                .vlan_id as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_dcb_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_id);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -765,9 +822,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()))
-                .pools as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_eth_vmdq_dcb_conf__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_dcb_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -796,9 +861,15 @@
         concat!("Alignment of ", stringify!(rte_eth_vmdq_dcb_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).nb_queue_pools
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_queue_pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -809,9 +880,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>()))
-                .enable_default_pool as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.enable_default_pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -822,9 +900,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).default_pool
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.default_pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         5usize,
         concat!(
@@ -835,9 +919,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).nb_pool_maps
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_pool_maps);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         6usize,
         concat!(
@@ -848,9 +938,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).pool_map
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pool_map);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -861,9 +957,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_conf>())).dcb_tc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_dcb_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1032usize,
         concat!(
@@ -909,9 +1011,15 @@
         concat!("Alignment of ", stringify!(rte_eth_dcb_rx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_rx_conf>())).nb_tcs as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_dcb_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_dcb_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_tcs);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -922,9 +1030,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_rx_conf>())).dcb_tc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_dcb_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_dcb_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -970,9 +1084,16 @@
         concat!("Alignment of ", stringify!(rte_eth_vmdq_dcb_tx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_tx_conf>())).nb_queue_pools
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_tx_conf>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_dcb_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_queue_pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -983,9 +1104,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_dcb_tx_conf>())).dcb_tc
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_dcb_tx_conf>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_dcb_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1031,9 +1159,15 @@
         concat!("Alignment of ", stringify!(rte_eth_dcb_tx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_tx_conf>())).nb_tcs as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_dcb_tx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_dcb_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_tcs);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1044,9 +1178,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_dcb_tx_conf>())).dcb_tc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_dcb_tx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_dcb_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1090,9 +1230,15 @@
         concat!("Alignment of ", stringify!(rte_eth_vmdq_tx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_tx_conf>())).nb_queue_pools
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_tx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_tx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_queue_pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1159,9 +1305,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf__bindgen_ty_1>()))
-                .vlan_id as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_eth_vmdq_rx_conf__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_rx_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_id);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1172,9 +1326,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf__bindgen_ty_1>())).pools
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_eth_vmdq_rx_conf__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_vmdq_rx_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -1203,9 +1365,15 @@
         concat!("Alignment of ", stringify!(rte_eth_vmdq_rx_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).nb_queue_pools
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_queue_pools);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1216,9 +1384,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).enable_default_pool
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.enable_default_pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1229,9 +1404,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).default_pool
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.default_pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         5usize,
         concat!(
@@ -1242,9 +1423,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).enable_loop_back
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.enable_loop_back);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         6usize,
         concat!(
@@ -1255,9 +1443,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).nb_pool_maps
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_pool_maps);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         7usize,
         concat!(
@@ -1268,9 +1462,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).rx_mode as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rx_mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -1281,9 +1481,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_vmdq_rx_conf>())).pool_map
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_vmdq_rx_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_vmdq_rx_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pool_map);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1374,9 +1580,15 @@
         concat!("Alignment of ", stringify!(rte_eth_ipv4_flow))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).src_ip as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_ip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1387,9 +1599,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).dst_ip as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_ip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1400,9 +1618,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).tos as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tos);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -1413,9 +1637,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).ttl as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ttl);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         9usize,
         concat!(
@@ -1426,9 +1656,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv4_flow>())).proto as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv4_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv4_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.proto);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         10usize,
         concat!(
@@ -1472,9 +1708,15 @@
         concat!("Alignment of ", stringify!(rte_eth_ipv6_flow))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).src_ip as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_ip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1485,9 +1727,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).dst_ip as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_ip);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1498,9 +1746,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).tc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -1511,9 +1765,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).proto as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.proto);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         33usize,
         concat!(
@@ -1524,9 +1784,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_ipv6_flow>())).hop_limits as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_ipv6_flow>() };
+            let struct_ptr = &struct_instance as *const rte_eth_ipv6_flow;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hop_limits);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         34usize,
         concat!(
@@ -1579,9 +1845,15 @@
         concat!("Alignment of ", stringify!(rte_eth_fdir_masks))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).vlan_tci_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_tci_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1592,9 +1864,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).ipv4_mask as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ipv4_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1605,9 +1883,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).ipv6_mask as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ipv6_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1618,9 +1902,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).src_port_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_port_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         52usize,
         concat!(
@@ -1631,9 +1921,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).dst_port_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dst_port_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         54usize,
         concat!(
@@ -1644,9 +1940,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).mac_addr_byte_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mac_addr_byte_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         56usize,
         concat!(
@@ -1657,9 +1960,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).tunnel_id_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tunnel_id_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         60usize,
         concat!(
@@ -1670,9 +1979,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_masks>())).tunnel_type_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_masks>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_masks;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.tunnel_type_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -1721,9 +2037,16 @@
         concat!("Alignment of ", stringify!(rte_eth_flex_payload_cfg))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_flex_payload_cfg>())).type_
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_flex_payload_cfg>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_flex_payload_cfg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.type_);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1734,9 +2057,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_flex_payload_cfg>())).src_offset
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_flex_payload_cfg>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_flex_payload_cfg;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_offset);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1782,9 +2112,15 @@
         concat!("Alignment of ", stringify!(rte_eth_fdir_flex_mask))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_mask>())).flow_type
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_mask>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_mask;
+            let field_ptr = std::ptr::addr_of!(struct_instance.flow_type);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1795,9 +2131,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_mask>())).mask as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_mask>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_mask;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -1838,9 +2180,15 @@
         concat!("Alignment of ", stringify!(rte_eth_fdir_flex_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).nb_payloads
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_payloads);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1851,9 +2199,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).nb_flexmasks
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_flexmasks);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -1864,9 +2218,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).flex_set
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.flex_set);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1877,9 +2237,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_fdir_flex_conf>())).flex_mask
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_fdir_flex_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_fdir_flex_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.flex_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         292usize,
         concat!(
@@ -1935,8 +2301,15 @@
         concat!("Alignment of ", stringify!(rte_fdir_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).mode as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1947,9 +2320,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).pballoc as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pballoc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -1960,9 +2339,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).status as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.status);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -1973,9 +2358,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).drop_queue as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.drop_queue);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -1986,8 +2377,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).mask as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1998,9 +2396,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_fdir_conf>())).flex_conf as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_fdir_conf>() };
+            let struct_ptr = &struct_instance as *const rte_fdir_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.flex_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         84usize,
         concat!(
@@ -2047,8 +2451,15 @@
         concat!("Alignment of ", stringify!(rte_intr_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_intr_conf>())).lsc as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_intr_conf>() };
+            let struct_ptr = &struct_instance as *const rte_intr_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lsc);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -2059,8 +2470,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_intr_conf>())).rxq as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_intr_conf>() };
+            let struct_ptr = &struct_instance as *const rte_intr_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rxq);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -2134,9 +2552,16 @@
         concat!("Alignment of ", stringify!(rte_eth_conf__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).rss_conf
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_conf__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rss_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -2147,9 +2572,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).vmdq_dcb_conf
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_conf__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vmdq_dcb_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -2160,9 +2592,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).dcb_rx_conf
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_conf__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dcb_rx_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1064usize,
         concat!(
@@ -2173,9 +2612,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_1>())).vmdq_rx_conf
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_eth_conf__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const rte_eth_conf__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vmdq_rx_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1080usize,
         concat!(
@@ -2220,45 +2666,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_eth_conf__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>()))
-                .vmdq_dcb_tx_conf as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(vmdq_dcb_tx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>())).dcb_tx_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(dcb_tx_conf)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf__bindgen_ty_2>())).vmdq_tx_conf
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_eth_conf__bindgen_ty_2),
-            "::",
-            stringify!(vmdq_tx_conf)
-        )
-    );
 }
 impl Clone for rte_eth_conf__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -2278,9 +2685,14 @@
         concat!("Alignment of ", stringify!(rte_eth_conf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).link_speeds as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.link_speeds);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -2291,8 +2703,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).rxmode as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rxmode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -2303,8 +2721,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).txmode as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.txmode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -2315,9 +2739,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).lpbk_mode as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lpbk_mode);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -2328,9 +2757,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).rx_adv_conf as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rx_adv_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -2341,9 +2775,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).tx_adv_conf as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tx_adv_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2152usize,
         concat!(
@@ -2354,9 +2793,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).dcb_capability_en
-                as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.dcb_capability_en);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2164usize,
         concat!(
@@ -2367,9 +2812,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).fdir_conf as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.fdir_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2168usize,
         concat!(
@@ -2380,9 +2830,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_conf>())).intr_conf as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_conf>() };
+            let struct_ptr = &struct_instance as *const rte_eth_conf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.intr_conf);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2940usize,
         concat!(
diff --git a/tests/expectations/tests/layout_kni_mbuf.rs b/tests/expectations/tests/layout_kni_mbuf.rs
index e73344c..8796b9a 100644
--- a/tests/expectations/tests/layout_kni_mbuf.rs
+++ b/tests/expectations/tests/layout_kni_mbuf.rs
@@ -45,9 +45,14 @@
         concat!("Alignment of ", stringify!(rte_kni_mbuf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).buf_addr as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.buf_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -58,9 +63,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).buf_physaddr as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.buf_physaddr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -71,8 +81,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad0 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pad0);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -83,9 +99,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).data_off as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data_off);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         18usize,
         concat!(
@@ -96,8 +117,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad1 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pad1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         20usize,
         concat!(
@@ -108,9 +135,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).nb_segs as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_segs);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         22usize,
         concat!(
@@ -121,8 +153,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad4 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pad4);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         23usize,
         concat!(
@@ -133,9 +171,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).ol_flags as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ol_flags);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -146,8 +189,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad2 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pad2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -158,9 +207,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pkt_len as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pkt_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         36usize,
         concat!(
@@ -171,9 +225,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).data_len as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         40usize,
         concat!(
@@ -184,8 +243,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pad3 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pad3);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -196,8 +261,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).pool as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         72usize,
         concat!(
@@ -208,8 +279,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_mbuf>())).next as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_kni_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.next);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         80usize,
         concat!(
diff --git a/tests/expectations/tests/layout_large_align_field.rs b/tests/expectations/tests/layout_large_align_field.rs
index 4208e72..8d28871 100644
--- a/tests/expectations/tests/layout_large_align_field.rs
+++ b/tests/expectations/tests/layout_large_align_field.rs
@@ -76,7 +76,15 @@
         concat!("Alignment of ", stringify!(ip_frag))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).ofs as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag>() };
+            let struct_ptr = &struct_instance as *const ip_frag;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ofs);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -86,7 +94,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).len as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag>() };
+            let struct_ptr = &struct_instance as *const ip_frag;
+            let field_ptr = std::ptr::addr_of!(struct_instance.len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         2usize,
         concat!(
             "Offset of field: ",
@@ -96,7 +112,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ip_frag>())).mb as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag>() };
+            let struct_ptr = &struct_instance as *const ip_frag;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mb);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!(
             "Offset of field: ",
@@ -139,8 +163,14 @@
         concat!("Alignment of ", stringify!(ip_frag_key))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).src_dst as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_key>() };
+            let struct_ptr = &struct_instance as *const ip_frag_key;
+            let field_ptr = std::ptr::addr_of!(struct_instance.src_dst);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -151,8 +181,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).id as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_key>() };
+            let struct_ptr = &struct_instance as *const ip_frag_key;
+            let field_ptr = std::ptr::addr_of!(struct_instance.id);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -163,8 +199,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_key>())).key_len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_key>() };
+            let struct_ptr = &struct_instance as *const ip_frag_key;
+            let field_ptr = std::ptr::addr_of!(struct_instance.key_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         36usize,
         concat!(
@@ -215,9 +257,16 @@
         concat!("Alignment of ", stringify!(ip_frag_pkt__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt__bindgen_ty_1>())).tqe_next
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_pkt__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const ip_frag_pkt__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tqe_next);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -228,9 +277,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt__bindgen_ty_1>())).tqe_prev
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_pkt__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const ip_frag_pkt__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tqe_prev);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -263,8 +319,14 @@
         concat!("Alignment of ", stringify!(ip_frag_pkt))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).lru as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lru);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -275,8 +337,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).key as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.key);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -287,8 +355,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).start as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.start);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         56usize,
         concat!(
@@ -299,9 +373,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).total_size as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.total_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -312,9 +391,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).frag_size as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.frag_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         68usize,
         concat!(
@@ -325,9 +409,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).last_idx as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.last_idx);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         72usize,
         concat!(
@@ -338,8 +427,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_pkt>())).frags as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_frag_pkt>() };
+            let struct_ptr = &struct_instance as *const ip_frag_pkt;
+            let field_ptr = std::ptr::addr_of!(struct_instance.frags);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         80usize,
         concat!(
@@ -378,9 +473,14 @@
         concat!("Alignment of ", stringify!(ip_pkt_list))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_pkt_list>())).tqh_first as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_pkt_list>() };
+            let struct_ptr = &struct_instance as *const ip_pkt_list;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tqh_first);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -391,9 +491,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_pkt_list>())).tqh_last as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ip_pkt_list>() };
+            let struct_ptr = &struct_instance as *const ip_pkt_list;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tqh_last);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -444,9 +549,15 @@
         concat!("Alignment of ", stringify!(ip_frag_tbl_stat))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).find_num as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_tbl_stat>() };
+            let struct_ptr = &struct_instance as *const ip_frag_tbl_stat;
+            let field_ptr = std::ptr::addr_of!(struct_instance.find_num);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -457,9 +568,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).add_num as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_tbl_stat>() };
+            let struct_ptr = &struct_instance as *const ip_frag_tbl_stat;
+            let field_ptr = std::ptr::addr_of!(struct_instance.add_num);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -470,9 +587,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).del_num as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_tbl_stat>() };
+            let struct_ptr = &struct_instance as *const ip_frag_tbl_stat;
+            let field_ptr = std::ptr::addr_of!(struct_instance.del_num);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -483,9 +606,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).reuse_num as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_tbl_stat>() };
+            let struct_ptr = &struct_instance as *const ip_frag_tbl_stat;
+            let field_ptr = std::ptr::addr_of!(struct_instance.reuse_num);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -496,9 +625,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).fail_total as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_tbl_stat>() };
+            let struct_ptr = &struct_instance as *const ip_frag_tbl_stat;
+            let field_ptr = std::ptr::addr_of!(struct_instance.fail_total);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -509,9 +644,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ip_frag_tbl_stat>())).fail_nospace
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ip_frag_tbl_stat>() };
+            let struct_ptr = &struct_instance as *const ip_frag_tbl_stat;
+            let field_ptr = std::ptr::addr_of!(struct_instance.fail_nospace);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         40usize,
         concat!(
@@ -572,9 +713,15 @@
         concat!("Alignment of ", stringify!(rte_ip_frag_tbl))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).max_cycles as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.max_cycles);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -585,9 +732,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).entry_mask as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.entry_mask);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -598,9 +751,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).max_entries as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.max_entries);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -611,9 +770,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).use_entries as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.use_entries);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -624,9 +789,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).bucket_entries
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bucket_entries);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         20usize,
         concat!(
@@ -637,9 +808,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).nb_entries as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_entries);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -650,9 +827,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).nb_buckets as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_buckets);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         28usize,
         concat!(
@@ -663,9 +846,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).last as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.last);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -676,8 +865,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).lru as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lru);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         40usize,
         concat!(
@@ -688,9 +884,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).stat as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.stat);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -701,8 +903,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ip_frag_tbl>())).pkt as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ip_frag_tbl>() };
+            let struct_ptr = &struct_instance as *const rte_ip_frag_tbl;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pkt);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         128usize,
         concat!(
diff --git a/tests/expectations/tests/layout_mbuf.rs b/tests/expectations/tests/layout_mbuf.rs
index aefce3d..a9fa1e9 100644
--- a/tests/expectations/tests/layout_mbuf.rs
+++ b/tests/expectations/tests/layout_mbuf.rs
@@ -117,8 +117,15 @@
         concat!("Alignment of ", stringify!(rte_atomic16_t))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_atomic16_t>())).cnt as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_atomic16_t>() };
+            let struct_ptr = &struct_instance as *const rte_atomic16_t;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cnt);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -202,32 +209,6 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_1>())).refcnt_atomic
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_1),
-            "::",
-            stringify!(refcnt_atomic)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_1>())).refcnt
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_1),
-            "::",
-            stringify!(refcnt)
-        )
-    );
 }
 impl Default for rte_mbuf__bindgen_ty_1 {
     fn default() -> Self {
@@ -421,19 +402,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_2>())).packet_type
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_2),
-            "::",
-            stringify!(packet_type)
-        )
-    );
 }
 impl Default for rte_mbuf__bindgen_ty_2 {
     fn default() -> Self {
@@ -480,8 +448,8 @@
 ) {
     assert_eq ! (:: std :: mem :: size_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 4usize , concat ! ("Size of: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1)));
     assert_eq ! (:: std :: mem :: align_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 2usize , concat ! ("Alignment of " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1)));
-    assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ())) . hash as * const _ as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash)));
-    assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ())) . id as * const _ as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id)));
+    assert_eq ! ({ let struct_instance = unsafe { std :: mem :: zeroed :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () } ; let struct_ptr = & struct_instance as * const rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ; let field_ptr = std :: ptr :: addr_of ! (struct_instance . hash) ; let struct_address = struct_ptr as usize ; let field_address = field_ptr as usize ; std :: mem :: forget (struct_instance) ; field_address . checked_sub (struct_address) . unwrap () } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash)));
+    assert_eq ! ({ let struct_instance = unsafe { std :: mem :: zeroed :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () } ; let struct_ptr = & struct_instance as * const rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ; let field_ptr = std :: ptr :: addr_of ! (struct_instance . id) ; let struct_address = struct_ptr as usize ; let field_address = field_ptr as usize ; std :: mem :: forget (struct_instance) ; field_address . checked_sub (struct_address) . unwrap () } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id)));
 }
 #[test]
 fn bindgen_test_layout_rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1() {
@@ -504,21 +472,6 @@
             stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1,
-            >()))
-            .lo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(lo)
-        )
-    );
 }
 impl Default for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
     fn default() -> Self {
@@ -548,9 +501,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>())).hi
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_mbuf__bindgen_ty_3__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hi);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -595,9 +556,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>())).lo
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_mbuf__bindgen_ty_3__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -608,9 +577,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>())).hi
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_mbuf__bindgen_ty_3__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hi);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -633,58 +610,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_3))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).rss as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(rss)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).fdir as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(fdir)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).sched as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(sched)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).usr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(usr)
-        )
-    );
 }
 impl Default for rte_mbuf__bindgen_ty_3 {
     fn default() -> Self {
@@ -715,32 +640,6 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_4))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_4>())).userdata
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_4),
-            "::",
-            stringify!(userdata)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_4>())).udata64
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_4),
-            "::",
-            stringify!(udata64)
-        )
-    );
 }
 impl Default for rte_mbuf__bindgen_ty_4 {
     fn default() -> Self {
@@ -915,19 +814,6 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_5))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_5>())).tx_offload
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_5),
-            "::",
-            stringify!(tx_offload)
-        )
-    );
 }
 impl Default for rte_mbuf__bindgen_ty_5 {
     fn default() -> Self {
@@ -951,8 +837,14 @@
         concat!("Alignment of ", stringify!(rte_mbuf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).cacheline0 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cacheline0);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -963,8 +855,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_addr as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.buf_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -975,9 +873,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_physaddr as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.buf_physaddr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -988,8 +891,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.buf_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1000,8 +909,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).rearm_data as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rearm_data);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         18usize,
         concat!(
@@ -1012,8 +927,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).data_off as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data_off);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         18usize,
         concat!(
@@ -1024,8 +945,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).nb_segs as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_segs);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         22usize,
         concat!(
@@ -1036,8 +963,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).port as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.port);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         23usize,
         concat!(
@@ -1048,8 +981,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).ol_flags as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ol_flags);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -1060,9 +999,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).rx_descriptor_fields1
-                as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.rx_descriptor_fields1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -1073,8 +1018,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).pkt_len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pkt_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         36usize,
         concat!(
@@ -1085,8 +1036,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).data_len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         40usize,
         concat!(
@@ -1097,8 +1054,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).vlan_tci as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_tci);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         42usize,
         concat!(
@@ -1109,8 +1072,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).hash as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hash);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         44usize,
         concat!(
@@ -1121,8 +1090,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).seqn as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.seqn);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         52usize,
         concat!(
@@ -1133,9 +1108,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).vlan_tci_outer as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_tci_outer);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         56usize,
         concat!(
@@ -1146,8 +1126,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).cacheline1 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cacheline1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -1158,8 +1144,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).pool as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         72usize,
         concat!(
@@ -1170,8 +1162,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).next as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.next);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         80usize,
         concat!(
@@ -1182,8 +1180,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).priv_size as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.priv_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         96usize,
         concat!(
@@ -1194,8 +1198,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).timesync as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.timesync);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         98usize,
         concat!(
diff --git a/tests/expectations/tests/layout_mbuf_1_0.rs b/tests/expectations/tests/layout_mbuf_1_0.rs
index ce4c66c..4ee237b 100644
--- a/tests/expectations/tests/layout_mbuf_1_0.rs
+++ b/tests/expectations/tests/layout_mbuf_1_0.rs
@@ -160,8 +160,15 @@
         concat!("Alignment of ", stringify!(rte_atomic16_t))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_atomic16_t>())).cnt as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_atomic16_t>() };
+            let struct_ptr = &struct_instance as *const rte_atomic16_t;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cnt);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -251,32 +258,6 @@
         2usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_1>())).refcnt_atomic
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_1),
-            "::",
-            stringify!(refcnt_atomic)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_1>())).refcnt
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_1),
-            "::",
-            stringify!(refcnt)
-        )
-    );
 }
 impl Clone for rte_mbuf__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -473,19 +454,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_2>())).packet_type
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_2),
-            "::",
-            stringify!(packet_type)
-        )
-    );
 }
 impl Clone for rte_mbuf__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -531,8 +499,8 @@
 ) {
     assert_eq ! (:: std :: mem :: size_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 4usize , concat ! ("Size of: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1)));
     assert_eq ! (:: std :: mem :: align_of :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () , 2usize , concat ! ("Alignment of " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1)));
-    assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ())) . hash as * const _ as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash)));
-    assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > ())) . id as * const _ as usize } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id)));
+    assert_eq ! ({ let struct_instance = unsafe { std :: mem :: zeroed :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () } ; let struct_ptr = & struct_instance as * const rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ; let field_ptr = std :: ptr :: addr_of ! (struct_instance . hash) ; let struct_address = struct_ptr as usize ; let field_address = field_ptr as usize ; std :: mem :: forget (struct_instance) ; field_address . checked_sub (struct_address) . unwrap () } , 0usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (hash)));
+    assert_eq ! ({ let struct_instance = unsafe { std :: mem :: zeroed :: < rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 > () } ; let struct_ptr = & struct_instance as * const rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1 ; let field_ptr = std :: ptr :: addr_of ! (struct_instance . id) ; let struct_address = struct_ptr as usize ; let field_address = field_ptr as usize ; std :: mem :: forget (struct_instance) ; field_address . checked_sub (struct_address) . unwrap () } , 2usize , concat ! ("Offset of field: " , stringify ! (rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1) , "::" , stringify ! (id)));
 }
 impl Clone
     for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1__bindgen_ty_1
@@ -562,21 +530,6 @@
             stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1)
         )
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1,
-            >()))
-            .lo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(lo)
-        )
-    );
 }
 impl Clone for rte_mbuf__bindgen_ty_3__bindgen_ty_1__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -602,9 +555,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>())).hi
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_mbuf__bindgen_ty_3__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_mbuf__bindgen_ty_3__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hi);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -645,9 +606,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>())).lo
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_mbuf__bindgen_ty_3__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.lo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -658,9 +627,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>())).hi
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<rte_mbuf__bindgen_ty_3__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const rte_mbuf__bindgen_ty_3__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hi);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -688,58 +665,6 @@
         4usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_3))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).rss as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(rss)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).fdir as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(fdir)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).sched as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(sched)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_3>())).usr as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_3),
-            "::",
-            stringify!(usr)
-        )
-    );
 }
 impl Clone for rte_mbuf__bindgen_ty_3 {
     fn clone(&self) -> Self {
@@ -767,32 +692,6 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_4))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_4>())).userdata
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_4),
-            "::",
-            stringify!(userdata)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_4>())).udata64
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_4),
-            "::",
-            stringify!(udata64)
-        )
-    );
 }
 impl Clone for rte_mbuf__bindgen_ty_4 {
     fn clone(&self) -> Self {
@@ -970,19 +869,6 @@
         8usize,
         concat!("Alignment of ", stringify!(rte_mbuf__bindgen_ty_5))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf__bindgen_ty_5>())).tx_offload
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(rte_mbuf__bindgen_ty_5),
-            "::",
-            stringify!(tx_offload)
-        )
-    );
 }
 impl Clone for rte_mbuf__bindgen_ty_5 {
     fn clone(&self) -> Self {
@@ -997,8 +883,14 @@
         concat!("Size of: ", stringify!(rte_mbuf))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).cacheline0 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cacheline0);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1009,8 +901,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_addr as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.buf_addr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -1021,9 +919,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_physaddr as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.buf_physaddr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -1034,8 +937,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).buf_len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.buf_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -1046,8 +955,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).rearm_data as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.rearm_data);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         18usize,
         concat!(
@@ -1058,8 +973,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).data_off as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data_off);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         18usize,
         concat!(
@@ -1070,8 +991,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).nb_segs as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.nb_segs);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         22usize,
         concat!(
@@ -1082,8 +1009,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).port as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.port);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         23usize,
         concat!(
@@ -1094,8 +1027,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).ol_flags as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ol_flags);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -1106,9 +1045,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).rx_descriptor_fields1
-                as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.rx_descriptor_fields1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         32usize,
         concat!(
@@ -1119,8 +1064,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).pkt_len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pkt_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         36usize,
         concat!(
@@ -1131,8 +1082,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).data_len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data_len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         40usize,
         concat!(
@@ -1143,8 +1100,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).vlan_tci as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_tci);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         42usize,
         concat!(
@@ -1155,8 +1118,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).hash as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.hash);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         44usize,
         concat!(
@@ -1167,8 +1136,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).seqn as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.seqn);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         52usize,
         concat!(
@@ -1179,9 +1154,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).vlan_tci_outer as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.vlan_tci_outer);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         56usize,
         concat!(
@@ -1192,8 +1172,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).cacheline1 as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cacheline1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         64usize,
         concat!(
@@ -1204,8 +1190,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).pool as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.pool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         72usize,
         concat!(
@@ -1216,8 +1208,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).next as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.next);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         80usize,
         concat!(
@@ -1228,8 +1226,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).priv_size as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.priv_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         96usize,
         concat!(
@@ -1240,8 +1244,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_mbuf>())).timesync as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_mbuf>() };
+            let struct_ptr = &struct_instance as *const rte_mbuf;
+            let field_ptr = std::ptr::addr_of!(struct_instance.timesync);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         98usize,
         concat!(
diff --git a/tests/expectations/tests/libclang-9/call-conv-field.rs b/tests/expectations/tests/libclang-9/call-conv-field.rs
index f134bd8..7d42cad 100644
--- a/tests/expectations/tests/libclang-9/call-conv-field.rs
+++ b/tests/expectations/tests/libclang-9/call-conv-field.rs
@@ -29,9 +29,15 @@
         concat!("Alignment of ", stringify!(JNINativeInterface_))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).GetVersion
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<JNINativeInterface_>() };
+            let struct_ptr = &struct_instance as *const JNINativeInterface_;
+            let field_ptr = std::ptr::addr_of!(struct_instance.GetVersion);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -42,9 +48,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JNINativeInterface_>())).__hack as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<JNINativeInterface_>() };
+            let struct_ptr = &struct_instance as *const JNINativeInterface_;
+            let field_ptr = std::ptr::addr_of!(struct_instance.__hack);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
diff --git a/tests/expectations/tests/libclang-9/class.rs b/tests/expectations/tests/libclang-9/class.rs
index e4527de..4b2b915 100644
--- a/tests/expectations/tests/libclang-9/class.rs
+++ b/tests/expectations/tests/libclang-9/class.rs
@@ -54,12 +54,28 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).big_array as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.big_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!(
             "Offset of field: ",
@@ -97,9 +113,16 @@
         concat!("Alignment of ", stringify!(C_with_zero_length_array))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -110,9 +133,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).big_array
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.big_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -123,9 +153,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>()))
-                .zero_length_array as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         37usize,
         concat!(
@@ -164,9 +202,16 @@
         concat!("Alignment of ", stringify!(C_with_zero_length_array_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array_2>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -177,9 +222,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>()))
-                .zero_length_array as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array_2>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array_2;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -209,9 +262,15 @@
         concat!("Alignment of ", stringify!(C_with_incomplete_array))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array>() };
+            let struct_ptr = &struct_instance as *const C_with_incomplete_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -222,9 +281,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).big_array
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array>() };
+            let struct_ptr = &struct_instance as *const C_with_incomplete_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.big_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -235,9 +300,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).incomplete_array
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array>() };
+            let struct_ptr = &struct_instance as *const C_with_incomplete_array;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         37usize,
         concat!(
@@ -276,9 +348,16 @@
         concat!("Alignment of ", stringify!(C_with_incomplete_array_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array_2>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array_2>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_incomplete_array_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -289,9 +368,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array_2>()))
-                .incomplete_array as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array_2>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_incomplete_array_2;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -328,11 +415,18 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .a as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<C_with_zero_length_array_and_incomplete_array>(
+                )
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -343,11 +437,18 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .big_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<C_with_zero_length_array_and_incomplete_array>(
+                )
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.big_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -358,11 +459,19 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .zero_length_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<C_with_zero_length_array_and_incomplete_array>(
+                )
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         37usize,
         concat!(
@@ -373,11 +482,19 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .incomplete_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<C_with_zero_length_array_and_incomplete_array>(
+                )
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         37usize,
         concat!(
@@ -425,11 +542,19 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .a as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >()
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -440,11 +565,20 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .zero_length_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >()
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array_2;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -455,11 +589,20 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .incomplete_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >()
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array_2;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -488,7 +631,15 @@
         concat!("Alignment of ", stringify!(WithDtor))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<WithDtor>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<WithDtor>() };
+            let struct_ptr = &struct_instance as *const WithDtor;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -516,9 +667,16 @@
         concat!("Alignment of ", stringify!(IncompleteArrayNonCopiable))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<IncompleteArrayNonCopiable>())).whatever
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<IncompleteArrayNonCopiable>() };
+            let struct_ptr =
+                &struct_instance as *const IncompleteArrayNonCopiable;
+            let field_ptr = std::ptr::addr_of!(struct_instance.whatever);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -529,9 +687,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<IncompleteArrayNonCopiable>()))
-                .incomplete_array as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<IncompleteArrayNonCopiable>() };
+            let struct_ptr =
+                &struct_instance as *const IncompleteArrayNonCopiable;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -569,16 +735,6 @@
         4usize,
         concat!("Alignment of ", stringify!(Union))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).i as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(i))
-    );
 }
 impl Default for Union {
     fn default() -> Self {
@@ -607,8 +763,14 @@
         concat!("Alignment of ", stringify!(WithUnion))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithUnion>())).data as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<WithUnion>() };
+            let struct_ptr = &struct_instance as *const WithUnion;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/libclang-9/class_1_0.rs b/tests/expectations/tests/libclang-9/class_1_0.rs
index 4263bd1..ae31f23 100644
--- a/tests/expectations/tests/libclang-9/class_1_0.rs
+++ b/tests/expectations/tests/libclang-9/class_1_0.rs
@@ -97,12 +97,28 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).big_array as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.big_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!(
             "Offset of field: ",
@@ -150,9 +166,16 @@
         concat!("Alignment of ", stringify!(C_with_zero_length_array))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -163,9 +186,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>())).big_array
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.big_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -176,9 +206,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array>()))
-                .zero_length_array as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         37usize,
         concat!(
@@ -217,9 +255,16 @@
         concat!("Alignment of ", stringify!(C_with_zero_length_array_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array_2>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -230,9 +275,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_zero_length_array_2>()))
-                .zero_length_array as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_zero_length_array_2>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_zero_length_array_2;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -262,9 +315,15 @@
         concat!("Alignment of ", stringify!(C_with_incomplete_array))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array>() };
+            let struct_ptr = &struct_instance as *const C_with_incomplete_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -275,9 +334,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).big_array
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array>() };
+            let struct_ptr = &struct_instance as *const C_with_incomplete_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.big_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -288,9 +353,16 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array>())).incomplete_array
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array>() };
+            let struct_ptr = &struct_instance as *const C_with_incomplete_array;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         37usize,
         concat!(
@@ -329,9 +401,16 @@
         concat!("Alignment of ", stringify!(C_with_incomplete_array_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array_2>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array_2>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_incomplete_array_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -342,9 +421,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C_with_incomplete_array_2>()))
-                .incomplete_array as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<C_with_incomplete_array_2>() };
+            let struct_ptr =
+                &struct_instance as *const C_with_incomplete_array_2;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -381,11 +468,18 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .a as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<C_with_zero_length_array_and_incomplete_array>(
+                )
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -396,11 +490,18 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .big_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<C_with_zero_length_array_and_incomplete_array>(
+                )
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array;
+            let field_ptr = std::ptr::addr_of!(struct_instance.big_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -411,11 +512,19 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .zero_length_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<C_with_zero_length_array_and_incomplete_array>(
+                )
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         37usize,
         concat!(
@@ -426,11 +535,19 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array,
-            >()))
-            .incomplete_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<C_with_zero_length_array_and_incomplete_array>(
+                )
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         37usize,
         concat!(
@@ -478,11 +595,19 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .a as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >()
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -493,11 +618,20 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .zero_length_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >()
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array_2;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -508,11 +642,20 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<
-                C_with_zero_length_array_and_incomplete_array_2,
-            >()))
-            .incomplete_array as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<
+                    C_with_zero_length_array_and_incomplete_array_2,
+                >()
+            };
+            let struct_ptr = &struct_instance
+                as *const C_with_zero_length_array_and_incomplete_array_2;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -541,7 +684,15 @@
         concat!("Alignment of ", stringify!(WithDtor))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<WithDtor>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<WithDtor>() };
+            let struct_ptr = &struct_instance as *const WithDtor;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -569,9 +720,16 @@
         concat!("Alignment of ", stringify!(IncompleteArrayNonCopiable))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<IncompleteArrayNonCopiable>())).whatever
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<IncompleteArrayNonCopiable>() };
+            let struct_ptr =
+                &struct_instance as *const IncompleteArrayNonCopiable;
+            let field_ptr = std::ptr::addr_of!(struct_instance.whatever);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -582,9 +740,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<IncompleteArrayNonCopiable>()))
-                .incomplete_array as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<IncompleteArrayNonCopiable>() };
+            let struct_ptr =
+                &struct_instance as *const IncompleteArrayNonCopiable;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -623,16 +789,6 @@
         4usize,
         concat!("Alignment of ", stringify!(Union))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).d as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(d))
-    );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Union>())).i as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Union), "::", stringify!(i))
-    );
 }
 impl Clone for Union {
     fn clone(&self) -> Self {
@@ -657,8 +813,14 @@
         concat!("Alignment of ", stringify!(WithUnion))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithUnion>())).data as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<WithUnion>() };
+            let struct_ptr = &struct_instance as *const WithUnion;
+            let field_ptr = std::ptr::addr_of!(struct_instance.data);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs b/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs
index 32607b3..8a11bcd 100644
--- a/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs
+++ b/tests/expectations/tests/libclang-9/derive-hash-struct-with-incomplete-array.rs
@@ -54,14 +54,28 @@
         concat!("Alignment of ", stringify!(test))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<test>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<test>() };
+            let struct_ptr = &struct_instance as *const test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(test), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<test>())).zero_length_array as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<test>() };
+            let struct_ptr = &struct_instance as *const test;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -91,14 +105,28 @@
         concat!("Alignment of ", stringify!(test2))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<test2>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<test2>() };
+            let struct_ptr = &struct_instance as *const test2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(test2), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<test2>())).incomplete_array as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<test2>() };
+            let struct_ptr = &struct_instance as *const test2;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -129,14 +157,28 @@
         concat!("Alignment of ", stringify!(test3))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<test3>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<test3>() };
+            let struct_ptr = &struct_instance as *const test3;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(test3), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<test3>())).zero_length_array as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<test3>() };
+            let struct_ptr = &struct_instance as *const test3;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.zero_length_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -147,9 +189,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<test3>())).incomplete_array as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<test3>() };
+            let struct_ptr = &struct_instance as *const test3;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.incomplete_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/libclang-9/incomplete-array-padding.rs b/tests/expectations/tests/libclang-9/incomplete-array-padding.rs
index 382195d..3848333 100644
--- a/tests/expectations/tests/libclang-9/incomplete-array-padding.rs
+++ b/tests/expectations/tests/libclang-9/incomplete-array-padding.rs
@@ -141,7 +141,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
     );
diff --git a/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs b/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs
index 49664cd..098ff15 100644
--- a/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs
+++ b/tests/expectations/tests/libclang-9/issue-643-inner-struct.rs
@@ -61,9 +61,15 @@
         concat!("Alignment of ", stringify!(rte_ring_prod))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring_prod>())).watermark as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ring_prod>() };
+            let struct_ptr = &struct_instance as *const rte_ring_prod;
+            let field_ptr = std::ptr::addr_of!(struct_instance.watermark);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -92,9 +98,15 @@
         concat!("Alignment of ", stringify!(rte_ring_cons))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring_cons>())).sc_dequeue as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<rte_ring_cons>() };
+            let struct_ptr = &struct_instance as *const rte_ring_cons;
+            let field_ptr = std::ptr::addr_of!(struct_instance.sc_dequeue);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -118,8 +130,14 @@
         concat!("Alignment of ", stringify!(rte_ring))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring>())).memzone as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_ring>() };
+            let struct_ptr = &struct_instance as *const rte_ring;
+            let field_ptr = std::ptr::addr_of!(struct_instance.memzone);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -130,8 +148,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring>())).prod as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_ring>() };
+            let struct_ptr = &struct_instance as *const rte_ring;
+            let field_ptr = std::ptr::addr_of!(struct_instance.prod);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -142,8 +166,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring>())).cons as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_ring>() };
+            let struct_ptr = &struct_instance as *const rte_ring;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cons);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -154,8 +184,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_ring>())).ring as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_ring>() };
+            let struct_ptr = &struct_instance as *const rte_ring;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ring);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
diff --git a/tests/expectations/tests/libclang-9/layout_align.rs b/tests/expectations/tests/libclang-9/layout_align.rs
index 4ad5417..899112c 100644
--- a/tests/expectations/tests/libclang-9/layout_align.rs
+++ b/tests/expectations/tests/libclang-9/layout_align.rs
@@ -148,8 +148,14 @@
         concat!("Alignment of ", stringify!(rte_kni_fifo))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).write as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_fifo>() };
+            let struct_ptr = &struct_instance as *const rte_kni_fifo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.write);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -160,8 +166,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).read as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_fifo>() };
+            let struct_ptr = &struct_instance as *const rte_kni_fifo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.read);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -172,8 +184,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).len as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_fifo>() };
+            let struct_ptr = &struct_instance as *const rte_kni_fifo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -184,9 +202,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).elem_size as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_fifo>() };
+            let struct_ptr = &struct_instance as *const rte_kni_fifo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.elem_size);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -197,8 +220,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_kni_fifo>())).buffer as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_kni_fifo>() };
+            let struct_ptr = &struct_instance as *const rte_kni_fifo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.buffer);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -241,9 +270,14 @@
         concat!("Alignment of ", stringify!(rte_eth_link))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<rte_eth_link>())).link_speed as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<rte_eth_link>() };
+            let struct_ptr = &struct_instance as *const rte_eth_link;
+            let field_ptr = std::ptr::addr_of!(struct_instance.link_speed);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs
index f874e9d..2d7d40e 100644
--- a/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs
+++ b/tests/expectations/tests/libclang-9/type_alias_template_specialized.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(Rooted))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Rooted>())).ptr as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Rooted>() };
+            let struct_ptr = &struct_instance as *const Rooted;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ptr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/libclang-9/zero-sized-array.rs b/tests/expectations/tests/libclang-9/zero-sized-array.rs
index 6514b93..10c0afa 100644
--- a/tests/expectations/tests/libclang-9/zero-sized-array.rs
+++ b/tests/expectations/tests/libclang-9/zero-sized-array.rs
@@ -54,8 +54,15 @@
         concat!("Alignment of ", stringify!(ZeroSizedArray))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ZeroSizedArray>())).arr as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ZeroSizedArray>() };
+            let struct_ptr = &struct_instance as *const ZeroSizedArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -85,9 +92,15 @@
         concat!("Alignment of ", stringify!(ContainsZeroSizedArray))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsZeroSizedArray>())).zsa as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContainsZeroSizedArray>() };
+            let struct_ptr = &struct_instance as *const ContainsZeroSizedArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.zsa);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -137,9 +150,15 @@
         concat!("Alignment of ", stringify!(DynamicallySizedArray))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<DynamicallySizedArray>())).arr as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<DynamicallySizedArray>() };
+            let struct_ptr = &struct_instance as *const DynamicallySizedArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -169,9 +188,16 @@
         concat!("Alignment of ", stringify!(ContainsDynamicallySizedArray))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsDynamicallySizedArray>())).dsa
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContainsDynamicallySizedArray>() };
+            let struct_ptr =
+                &struct_instance as *const ContainsDynamicallySizedArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.dsa);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/long_double.rs b/tests/expectations/tests/long_double.rs
index dbd4248..0834ff9 100644
--- a/tests/expectations/tests/long_double.rs
+++ b/tests/expectations/tests/long_double.rs
@@ -24,7 +24,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/msvc-no-usr.rs b/tests/expectations/tests/msvc-no-usr.rs
index ea5a90b..ec5bab0 100644
--- a/tests/expectations/tests/msvc-no-usr.rs
+++ b/tests/expectations/tests/msvc-no-usr.rs
@@ -24,7 +24,15 @@
         concat!("Alignment of ", stringify!(A))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).foo as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(foo))
     );
diff --git a/tests/expectations/tests/mutable.rs b/tests/expectations/tests/mutable.rs
index 9f5865f..28f861c 100644
--- a/tests/expectations/tests/mutable.rs
+++ b/tests/expectations/tests/mutable.rs
@@ -24,7 +24,15 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).m_member as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m_member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -34,7 +42,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).m_other as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m_other);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!(
             "Offset of field: ",
@@ -62,9 +78,14 @@
         concat!("Alignment of ", stringify!(NonCopiable))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<NonCopiable>())).m_member as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<NonCopiable>() };
+            let struct_ptr = &struct_instance as *const NonCopiable;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m_member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -99,9 +120,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<NonCopiableWithNonCopiableMutableMember>()))
-                .m_member as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<NonCopiableWithNonCopiableMutableMember>()
+            };
+            let struct_ptr = &struct_instance
+                as *const NonCopiableWithNonCopiableMutableMember;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m_member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/namespace.rs b/tests/expectations/tests/namespace.rs
index 576fc93..abe4fb4 100644
--- a/tests/expectations/tests/namespace.rs
+++ b/tests/expectations/tests/namespace.rs
@@ -44,7 +44,15 @@
                 concat!("Alignment of ", stringify!(A))
             );
             assert_eq!(
-                unsafe { &(*(::std::ptr::null::<A>())).b as *const _ as usize },
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<A>() };
+                    let struct_ptr = &struct_instance as *const A;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.b);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
+                },
                 0usize,
                 concat!(
                     "Offset of field: ",
diff --git a/tests/expectations/tests/nested.rs b/tests/expectations/tests/nested.rs
index 92cd660..9a1ede6 100644
--- a/tests/expectations/tests/nested.rs
+++ b/tests/expectations/tests/nested.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(Calc))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Calc>())).w as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Calc>() };
+            let struct_ptr = &struct_instance as *const Calc;
+            let field_ptr = std::ptr::addr_of!(struct_instance.w);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Calc), "::", stringify!(w))
     );
@@ -70,8 +78,14 @@
         concat!("Alignment of ", stringify!(Test_Size))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Test_Size>())).mWidth as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test_Size>() };
+            let struct_ptr = &struct_instance as *const Test_Size;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mWidth);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -82,8 +96,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Test_Size>())).mHeight as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test_Size>() };
+            let struct_ptr = &struct_instance as *const Test_Size;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mHeight);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/nested_within_namespace.rs b/tests/expectations/tests/nested_within_namespace.rs
index 86b9b8c..158f4b7 100644
--- a/tests/expectations/tests/nested_within_namespace.rs
+++ b/tests/expectations/tests/nested_within_namespace.rs
@@ -35,8 +35,15 @@
                 concat!("Alignment of ", stringify!(Bar_Baz))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar_Baz>())).foo as *const _ as usize
+                {
+                    let struct_instance =
+                        unsafe { std::mem::zeroed::<Bar_Baz>() };
+                    let struct_ptr = &struct_instance as *const Bar_Baz;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -60,8 +67,14 @@
                 concat!("Alignment of ", stringify!(Bar))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).foo as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+                    let struct_ptr = &struct_instance as *const Bar;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -90,8 +103,14 @@
                 concat!("Alignment of ", stringify!(Baz))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Baz>())).baz as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Baz>() };
+                    let struct_ptr = &struct_instance as *const Baz;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
diff --git a/tests/expectations/tests/no-comments.rs b/tests/expectations/tests/no-comments.rs
index 7a9d0d8..e7d5620 100644
--- a/tests/expectations/tests/no-comments.rs
+++ b/tests/expectations/tests/no-comments.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).s as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.s);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(s))
     );
diff --git a/tests/expectations/tests/no-derive-debug.rs b/tests/expectations/tests/no-derive-debug.rs
index a62eaa5..6460178 100644
--- a/tests/expectations/tests/no-derive-debug.rs
+++ b/tests/expectations/tests/no-derive-debug.rs
@@ -32,12 +32,28 @@
         concat!("Alignment of ", stringify!(bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).foo as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(bar), "::", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(bar), "::", stringify!(baz))
     );
diff --git a/tests/expectations/tests/no-derive-default.rs b/tests/expectations/tests/no-derive-default.rs
index eda13aa..5656d0b 100644
--- a/tests/expectations/tests/no-derive-default.rs
+++ b/tests/expectations/tests/no-derive-default.rs
@@ -32,12 +32,28 @@
         concat!("Alignment of ", stringify!(bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).foo as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(bar), "::", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bar>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bar>() };
+            let struct_ptr = &struct_instance as *const bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(bar), "::", stringify!(baz))
     );
diff --git a/tests/expectations/tests/no-hash-allowlisted.rs b/tests/expectations/tests/no-hash-allowlisted.rs
index 1cd7f67..4f07c38 100644
--- a/tests/expectations/tests/no-hash-allowlisted.rs
+++ b/tests/expectations/tests/no-hash-allowlisted.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(NoHash))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoHash>())).i as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<NoHash>() };
+            let struct_ptr = &struct_instance as *const NoHash;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(NoHash), "::", stringify!(i))
     );
diff --git a/tests/expectations/tests/no-partialeq-allowlisted.rs b/tests/expectations/tests/no-partialeq-allowlisted.rs
index cd3ed3b..e10f4f2 100644
--- a/tests/expectations/tests/no-partialeq-allowlisted.rs
+++ b/tests/expectations/tests/no-partialeq-allowlisted.rs
@@ -23,8 +23,14 @@
         concat!("Alignment of ", stringify!(NoPartialEq))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<NoPartialEq>())).i as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<NoPartialEq>() };
+            let struct_ptr = &struct_instance as *const NoPartialEq;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/no-recursive-allowlisting.rs b/tests/expectations/tests/no-recursive-allowlisting.rs
index 0aa0b5e..3d02d05 100644
--- a/tests/expectations/tests/no-recursive-allowlisting.rs
+++ b/tests/expectations/tests/no-recursive-allowlisting.rs
@@ -25,7 +25,15 @@
         concat!("Alignment of ", stringify!(Foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Foo>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+            let struct_ptr = &struct_instance as *const Foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Foo), "::", stringify!(baz))
     );
diff --git a/tests/expectations/tests/no-std.rs b/tests/expectations/tests/no-std.rs
index f63ac45..9de5d52 100644
--- a/tests/expectations/tests/no-std.rs
+++ b/tests/expectations/tests/no-std.rs
@@ -30,17 +30,41 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/no_copy_allowlisted.rs b/tests/expectations/tests/no_copy_allowlisted.rs
index fa53bb6..bec0066 100644
--- a/tests/expectations/tests/no_copy_allowlisted.rs
+++ b/tests/expectations/tests/no_copy_allowlisted.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(NoCopy))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoCopy>())).i as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<NoCopy>() };
+            let struct_ptr = &struct_instance as *const NoCopy;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(NoCopy), "::", stringify!(i))
     );
diff --git a/tests/expectations/tests/no_debug_allowlisted.rs b/tests/expectations/tests/no_debug_allowlisted.rs
index e240d64..f5f8cf5 100644
--- a/tests/expectations/tests/no_debug_allowlisted.rs
+++ b/tests/expectations/tests/no_debug_allowlisted.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(NoDebug))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoDebug>())).i as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<NoDebug>() };
+            let struct_ptr = &struct_instance as *const NoDebug;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/no_default_allowlisted.rs b/tests/expectations/tests/no_default_allowlisted.rs
index 980f157..1b726b3 100644
--- a/tests/expectations/tests/no_default_allowlisted.rs
+++ b/tests/expectations/tests/no_default_allowlisted.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(NoDefault))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<NoDefault>())).i as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<NoDefault>() };
+            let struct_ptr = &struct_instance as *const NoDefault;
+            let field_ptr = std::ptr::addr_of!(struct_instance.i);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/non-type-params.rs b/tests/expectations/tests/non-type-params.rs
index acd7a09..9443cd1 100644
--- a/tests/expectations/tests/non-type-params.rs
+++ b/tests/expectations/tests/non-type-params.rs
@@ -27,9 +27,14 @@
         concat!("Alignment of ", stringify!(UsesArray))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UsesArray>())).array_char_16 as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<UsesArray>() };
+            let struct_ptr = &struct_instance as *const UsesArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.array_char_16);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -40,9 +45,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UsesArray>())).array_bool_8 as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<UsesArray>() };
+            let struct_ptr = &struct_instance as *const UsesArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.array_bool_8);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -53,9 +63,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UsesArray>())).array_int_4 as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<UsesArray>() };
+            let struct_ptr = &struct_instance as *const UsesArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.array_int_4);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
diff --git a/tests/expectations/tests/objc_interface_type.rs b/tests/expectations/tests/objc_interface_type.rs
index cef29c8..4552e3a 100644
--- a/tests/expectations/tests/objc_interface_type.rs
+++ b/tests/expectations/tests/objc_interface_type.rs
@@ -45,8 +45,14 @@
         concat!("Alignment of ", stringify!(FooStruct))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<FooStruct>())).foo as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<FooStruct>() };
+            let struct_ptr = &struct_instance as *const FooStruct;
+            let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/opaque-template-inst-member-2.rs b/tests/expectations/tests/opaque-template-inst-member-2.rs
index f47aff0..c54d11c 100644
--- a/tests/expectations/tests/opaque-template-inst-member-2.rs
+++ b/tests/expectations/tests/opaque-template-inst-member-2.rs
@@ -32,9 +32,15 @@
         concat!("Alignment of ", stringify!(ContainsOpaqueTemplate))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueTemplate>())).mBlah as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContainsOpaqueTemplate>() };
+            let struct_ptr = &struct_instance as *const ContainsOpaqueTemplate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBlah);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -45,9 +51,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueTemplate>())).mBaz as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContainsOpaqueTemplate>() };
+            let struct_ptr = &struct_instance as *const ContainsOpaqueTemplate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBaz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -78,9 +90,15 @@
         concat!("Alignment of ", stringify!(InheritsOpaqueTemplate))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<InheritsOpaqueTemplate>())).wow as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<InheritsOpaqueTemplate>() };
+            let struct_ptr = &struct_instance as *const InheritsOpaqueTemplate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.wow);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
diff --git a/tests/expectations/tests/opaque-template-inst-member.rs b/tests/expectations/tests/opaque-template-inst-member.rs
index a3c6778..e7c98a9 100644
--- a/tests/expectations/tests/opaque-template-inst-member.rs
+++ b/tests/expectations/tests/opaque-template-inst-member.rs
@@ -30,9 +30,15 @@
         concat!("Alignment of ", stringify!(ContainsOpaqueTemplate))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueTemplate>())).mBlah as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContainsOpaqueTemplate>() };
+            let struct_ptr = &struct_instance as *const ContainsOpaqueTemplate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBlah);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -43,9 +49,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueTemplate>())).mBaz as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContainsOpaqueTemplate>() };
+            let struct_ptr = &struct_instance as *const ContainsOpaqueTemplate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBaz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         404usize,
         concat!(
@@ -90,9 +102,15 @@
         concat!("Alignment of ", stringify!(InheritsOpaqueTemplate))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<InheritsOpaqueTemplate>())).wow as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<InheritsOpaqueTemplate>() };
+            let struct_ptr = &struct_instance as *const InheritsOpaqueTemplate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.wow);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         408usize,
         concat!(
diff --git a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
index e972443..50d27d0 100644
--- a/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
+++ b/tests/expectations/tests/opaque-template-instantiation-namespaced.rs
@@ -46,8 +46,14 @@
                 concat!("Alignment of ", stringify!(Foo))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Foo>())).c as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Foo>() };
+                    let struct_ptr = &struct_instance as *const Foo;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.c);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -76,8 +82,14 @@
                 concat!("Alignment of ", stringify!(Bar))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).i as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+                    let struct_ptr = &struct_instance as *const Bar;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.i);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -106,9 +118,17 @@
                 concat!("Alignment of ", stringify!(ContainsInstantiation))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<ContainsInstantiation>())).not_opaque
-                        as *const _ as usize
+                {
+                    let struct_instance =
+                        unsafe { std::mem::zeroed::<ContainsInstantiation>() };
+                    let struct_ptr =
+                        &struct_instance as *const ContainsInstantiation;
+                    let field_ptr =
+                        std::ptr::addr_of!(struct_instance.not_opaque);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -149,9 +169,17 @@
                 )
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<ContainsOpaqueInstantiation>()))
-                        .opaque as *const _ as usize
+                {
+                    let struct_instance = unsafe {
+                        std::mem::zeroed::<ContainsOpaqueInstantiation>()
+                    };
+                    let struct_ptr =
+                        &struct_instance as *const ContainsOpaqueInstantiation;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.opaque);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
diff --git a/tests/expectations/tests/opaque-template-instantiation.rs b/tests/expectations/tests/opaque-template-instantiation.rs
index 6f0f31b..72ca95a 100644
--- a/tests/expectations/tests/opaque-template-instantiation.rs
+++ b/tests/expectations/tests/opaque-template-instantiation.rs
@@ -38,9 +38,15 @@
         concat!("Alignment of ", stringify!(ContainsInstantiation))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsInstantiation>())).not_opaque
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContainsInstantiation>() };
+            let struct_ptr = &struct_instance as *const ContainsInstantiation;
+            let field_ptr = std::ptr::addr_of!(struct_instance.not_opaque);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -78,9 +84,16 @@
         concat!("Alignment of ", stringify!(ContainsOpaqueInstantiation))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContainsOpaqueInstantiation>())).opaque
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContainsOpaqueInstantiation>() };
+            let struct_ptr =
+                &struct_instance as *const ContainsOpaqueInstantiation;
+            let field_ptr = std::ptr::addr_of!(struct_instance.opaque);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/opaque_in_struct.rs b/tests/expectations/tests/opaque_in_struct.rs
index 980df3d..eec1c45 100644
--- a/tests/expectations/tests/opaque_in_struct.rs
+++ b/tests/expectations/tests/opaque_in_struct.rs
@@ -43,8 +43,14 @@
         concat!("Alignment of ", stringify!(container))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<container>())).contained as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<container>() };
+            let struct_ptr = &struct_instance as *const container;
+            let field_ptr = std::ptr::addr_of!(struct_instance.contained);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/opaque_pointer.rs b/tests/expectations/tests/opaque_pointer.rs
index 90b019b..b5c4927 100644
--- a/tests/expectations/tests/opaque_pointer.rs
+++ b/tests/expectations/tests/opaque_pointer.rs
@@ -51,9 +51,15 @@
         concat!("Alignment of ", stringify!(WithOpaquePtr))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithOpaquePtr>())).whatever as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<WithOpaquePtr>() };
+            let struct_ptr = &struct_instance as *const WithOpaquePtr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.whatever);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -64,8 +70,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithOpaquePtr>())).other as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<WithOpaquePtr>() };
+            let struct_ptr = &struct_instance as *const WithOpaquePtr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.other);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -76,8 +89,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithOpaquePtr>())).t as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<WithOpaquePtr>() };
+            let struct_ptr = &struct_instance as *const WithOpaquePtr;
+            let field_ptr = std::ptr::addr_of!(struct_instance.t);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
diff --git a/tests/expectations/tests/packed-n-with-padding.rs b/tests/expectations/tests/packed-n-with-padding.rs
index 13cb030..1aa49e8 100644
--- a/tests/expectations/tests/packed-n-with-padding.rs
+++ b/tests/expectations/tests/packed-n-with-padding.rs
@@ -26,22 +26,54 @@
         concat!("Alignment of ", stringify!(Packed))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Packed>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Packed>() };
+            let struct_ptr = &struct_instance as *const Packed;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Packed), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Packed>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Packed>() };
+            let struct_ptr = &struct_instance as *const Packed;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         2usize,
         concat!("Offset of field: ", stringify!(Packed), "::", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Packed>())).c as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Packed>() };
+            let struct_ptr = &struct_instance as *const Packed;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(Packed), "::", stringify!(c))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Packed>())).d as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Packed>() };
+            let struct_ptr = &struct_instance as *const Packed;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         6usize,
         concat!("Offset of field: ", stringify!(Packed), "::", stringify!(d))
     );
diff --git a/tests/expectations/tests/private.rs b/tests/expectations/tests/private.rs
index 328f97f..0586ae7 100644
--- a/tests/expectations/tests/private.rs
+++ b/tests/expectations/tests/private.rs
@@ -25,9 +25,14 @@
         concat!("Alignment of ", stringify!(HasPrivate))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<HasPrivate>())).mNotPrivate as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<HasPrivate>() };
+            let struct_ptr = &struct_instance as *const HasPrivate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mNotPrivate);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -38,9 +43,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<HasPrivate>())).mIsPrivate as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<HasPrivate>() };
+            let struct_ptr = &struct_instance as *const HasPrivate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mIsPrivate);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -71,9 +81,14 @@
         concat!("Alignment of ", stringify!(VeryPrivate))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<VeryPrivate>())).mIsPrivate as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<VeryPrivate>() };
+            let struct_ptr = &struct_instance as *const VeryPrivate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mIsPrivate);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -84,9 +99,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<VeryPrivate>())).mIsAlsoPrivate as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<VeryPrivate>() };
+            let struct_ptr = &struct_instance as *const VeryPrivate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mIsAlsoPrivate);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -118,9 +138,15 @@
         concat!("Alignment of ", stringify!(ContradictPrivate))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictPrivate>())).mNotPrivate
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContradictPrivate>() };
+            let struct_ptr = &struct_instance as *const ContradictPrivate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mNotPrivate);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -131,9 +157,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<ContradictPrivate>())).mIsPrivate as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<ContradictPrivate>() };
+            let struct_ptr = &struct_instance as *const ContradictPrivate;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mIsPrivate);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/private_fields.rs b/tests/expectations/tests/private_fields.rs
index 92a4bf6..8e674b4 100644
--- a/tests/expectations/tests/private_fields.rs
+++ b/tests/expectations/tests/private_fields.rs
@@ -110,7 +110,15 @@
         concat!("Alignment of ", stringify!(PubPriv))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<PubPriv>())).x as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PubPriv>() };
+            let struct_ptr = &struct_instance as *const PubPriv;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -120,7 +128,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<PubPriv>())).y as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<PubPriv>() };
+            let struct_ptr = &struct_instance as *const PubPriv;
+            let field_ptr = std::ptr::addr_of!(struct_instance.y);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!(
             "Offset of field: ",
@@ -346,7 +362,15 @@
         concat!("Alignment of ", stringify!(Base))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Base>())).member as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Base>() };
+            let struct_ptr = &struct_instance as *const Base;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -416,9 +440,16 @@
         concat!("Alignment of ", stringify!(WithAnonStruct__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithAnonStruct__bindgen_ty_1>())).a
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<WithAnonStruct__bindgen_ty_1>() };
+            let struct_ptr =
+                &struct_instance as *const WithAnonStruct__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -447,9 +478,16 @@
         concat!("Alignment of ", stringify!(WithAnonStruct__bindgen_ty_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithAnonStruct__bindgen_ty_2>())).b
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<WithAnonStruct__bindgen_ty_2>() };
+            let struct_ptr =
+                &struct_instance as *const WithAnonStruct__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/reparented_replacement.rs b/tests/expectations/tests/reparented_replacement.rs
index 1f4fa6e..cbfafab 100644
--- a/tests/expectations/tests/reparented_replacement.rs
+++ b/tests/expectations/tests/reparented_replacement.rs
@@ -31,8 +31,14 @@
                 concat!("Alignment of ", stringify!(Bar))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<Bar>())).bazz as *const _ as usize
+                {
+                    let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+                    let struct_ptr = &struct_instance as *const Bar;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.bazz);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
diff --git a/tests/expectations/tests/replace_use.rs b/tests/expectations/tests/replace_use.rs
index 7bec94b..ad320ad 100644
--- a/tests/expectations/tests/replace_use.rs
+++ b/tests/expectations/tests/replace_use.rs
@@ -29,7 +29,15 @@
         concat!("Alignment of ", stringify!(Test))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(a))
     );
diff --git a/tests/expectations/tests/repr-align.rs b/tests/expectations/tests/repr-align.rs
index df23536..bf3fc8c 100644
--- a/tests/expectations/tests/repr-align.rs
+++ b/tests/expectations/tests/repr-align.rs
@@ -26,12 +26,28 @@
         concat!("Alignment of ", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<a>() };
+            let struct_ptr = &struct_instance as *const a;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).c as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<a>() };
+            let struct_ptr = &struct_instance as *const a;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(a), "::", stringify!(c))
     );
@@ -56,12 +72,28 @@
         concat!("Alignment of ", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<b>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<b>() };
+            let struct_ptr = &struct_instance as *const b;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(b), "::", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<b>())).c as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<b>() };
+            let struct_ptr = &struct_instance as *const b;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(b), "::", stringify!(c))
     );
diff --git a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
index 056b671..1d6393d 100644
--- a/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
+++ b/tests/expectations/tests/same_struct_name_in_different_namespaces.rs
@@ -29,8 +29,15 @@
         concat!("Alignment of ", stringify!(JS_shadow_Zone))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JS_shadow_Zone>())).x as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<JS_shadow_Zone>() };
+            let struct_ptr = &struct_instance as *const JS_shadow_Zone;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -41,8 +48,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<JS_shadow_Zone>())).y as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<JS_shadow_Zone>() };
+            let struct_ptr = &struct_instance as *const JS_shadow_Zone;
+            let field_ptr = std::ptr::addr_of!(struct_instance.y);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/sentry-defined-multiple-times.rs b/tests/expectations/tests/sentry-defined-multiple-times.rs
index 5f2ec54..6b5b15f 100644
--- a/tests/expectations/tests/sentry-defined-multiple-times.rs
+++ b/tests/expectations/tests/sentry-defined-multiple-times.rs
@@ -40,9 +40,16 @@
                 concat!("Alignment of ", stringify!(sentry))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<sentry>())).i_am_plain_sentry
-                        as *const _ as usize
+                {
+                    let struct_instance =
+                        unsafe { std::mem::zeroed::<sentry>() };
+                    let struct_ptr = &struct_instance as *const sentry;
+                    let field_ptr =
+                        std::ptr::addr_of!(struct_instance.i_am_plain_sentry);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -89,10 +96,19 @@
                 concat!("Alignment of ", stringify!(NotTemplateWrapper_sentry))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<NotTemplateWrapper_sentry>()))
-                        .i_am_not_template_wrapper_sentry
-                        as *const _ as usize
+                {
+                    let struct_instance = unsafe {
+                        std::mem::zeroed::<NotTemplateWrapper_sentry>()
+                    };
+                    let struct_ptr =
+                        &struct_instance as *const NotTemplateWrapper_sentry;
+                    let field_ptr = std::ptr::addr_of!(
+                        struct_instance.i_am_not_template_wrapper_sentry
+                    );
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -132,10 +148,19 @@
                 )
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<InlineNotTemplateWrapper_sentry>()))
-                        .i_am_inline_not_template_wrapper_sentry
-                        as *const _ as usize
+                {
+                    let struct_instance = unsafe {
+                        std::mem::zeroed::<InlineNotTemplateWrapper_sentry>()
+                    };
+                    let struct_ptr = &struct_instance
+                        as *const InlineNotTemplateWrapper_sentry;
+                    let field_ptr = std::ptr::addr_of!(
+                        struct_instance.i_am_inline_not_template_wrapper_sentry
+                    );
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -239,12 +264,21 @@
                 )
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<
-                        OuterDoubleWrapper_InnerDoubleWrapper_sentry,
-                    >()))
-                    .i_am_double_wrapper_sentry as *const _
-                        as usize
+                {
+                    let struct_instance = unsafe {
+                        std::mem::zeroed::<
+                            OuterDoubleWrapper_InnerDoubleWrapper_sentry,
+                        >()
+                    };
+                    let struct_ptr = &struct_instance
+                        as *const OuterDoubleWrapper_InnerDoubleWrapper_sentry;
+                    let field_ptr = std::ptr::addr_of!(
+                        struct_instance.i_am_double_wrapper_sentry
+                    );
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -275,7 +309,7 @@
         ) {
             assert_eq ! (:: std :: mem :: size_of :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > () , 4usize , concat ! ("Size of: " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry)));
             assert_eq ! (:: std :: mem :: align_of :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > () , 4usize , concat ! ("Alignment of " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry)));
-            assert_eq ! (unsafe { & (* (:: std :: ptr :: null :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > ())) . i_am_double_wrapper_inline_sentry as * const _ as usize } , 0usize , concat ! ("Offset of field: " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry) , "::" , stringify ! (i_am_double_wrapper_inline_sentry)));
+            assert_eq ! ({ let struct_instance = unsafe { std :: mem :: zeroed :: < OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry > () } ; let struct_ptr = & struct_instance as * const OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry ; let field_ptr = std :: ptr :: addr_of ! (struct_instance . i_am_double_wrapper_inline_sentry) ; let struct_address = struct_ptr as usize ; let field_address = field_ptr as usize ; std :: mem :: forget (struct_instance) ; field_address . checked_sub (struct_address) . unwrap () } , 0usize , concat ! ("Offset of field: " , stringify ! (OuterDoubleInlineWrapper_InnerDoubleInlineWrapper_sentry) , "::" , stringify ! (i_am_double_wrapper_inline_sentry)));
         }
         #[test]
         fn bindgen_test_layout_OuterDoubleInlineWrapper_InnerDoubleInlineWrapper(
@@ -347,9 +381,16 @@
             concat!("Alignment of ", stringify!(sentry))
         );
         assert_eq!(
-            unsafe {
-                &(*(::std::ptr::null::<sentry>())).i_am_outside_namespace_sentry
-                    as *const _ as usize
+            {
+                let struct_instance = unsafe { std::mem::zeroed::<sentry>() };
+                let struct_ptr = &struct_instance as *const sentry;
+                let field_ptr = std::ptr::addr_of!(
+                    struct_instance.i_am_outside_namespace_sentry
+                );
+                let struct_address = struct_ptr as usize;
+                let field_address = field_ptr as usize;
+                std::mem::forget(struct_instance);
+                field_address.checked_sub(struct_address).unwrap()
             },
             0usize,
             concat!(
diff --git a/tests/expectations/tests/size_t_is_usize.rs b/tests/expectations/tests/size_t_is_usize.rs
index 0d9ab2c..39e76a7 100644
--- a/tests/expectations/tests/size_t_is_usize.rs
+++ b/tests/expectations/tests/size_t_is_usize.rs
@@ -25,17 +25,41 @@
         concat!("Alignment of ", stringify!(A))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).len as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.len);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(len))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).offset as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.offset);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(offset))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).next as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.next);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         16usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(next))
     );
diff --git a/tests/expectations/tests/size_t_template.rs b/tests/expectations/tests/size_t_template.rs
index 6796bc9..c591433 100644
--- a/tests/expectations/tests/size_t_template.rs
+++ b/tests/expectations/tests/size_t_template.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).arr as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.arr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(arr))
     );
diff --git a/tests/expectations/tests/struct_containing_forward_declared_struct.rs b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
index 7298095..3cd285a 100644
--- a/tests/expectations/tests/struct_containing_forward_declared_struct.rs
+++ b/tests/expectations/tests/struct_containing_forward_declared_struct.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).val_a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<a>() };
+            let struct_ptr = &struct_instance as *const a;
+            let field_ptr = std::ptr::addr_of!(struct_instance.val_a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(a), "::", stringify!(val_a))
     );
@@ -55,7 +63,15 @@
         concat!("Alignment of ", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<b>())).val_b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<b>() };
+            let struct_ptr = &struct_instance as *const b;
+            let field_ptr = std::ptr::addr_of!(struct_instance.val_b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(b), "::", stringify!(val_b))
     );
diff --git a/tests/expectations/tests/struct_typedef.rs b/tests/expectations/tests/struct_typedef.rs
index 34c9dbd..e9f049b 100644
--- a/tests/expectations/tests/struct_typedef.rs
+++ b/tests/expectations/tests/struct_typedef.rs
@@ -23,9 +23,15 @@
         concat!("Alignment of ", stringify!(typedef_named_struct))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<typedef_named_struct>())).has_name
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<typedef_named_struct>() };
+            let struct_ptr = &struct_instance as *const typedef_named_struct;
+            let field_ptr = std::ptr::addr_of!(struct_instance.has_name);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -54,9 +60,15 @@
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<_bindgen_ty_1>())).no_name as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<_bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const _bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.no_name);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/struct_typedef_ns.rs b/tests/expectations/tests/struct_typedef_ns.rs
index ef91fe4..7aaaa41 100644
--- a/tests/expectations/tests/struct_typedef_ns.rs
+++ b/tests/expectations/tests/struct_typedef_ns.rs
@@ -30,9 +30,15 @@
                 concat!("Alignment of ", stringify!(typedef_struct))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<typedef_struct>())).foo as *const _
-                        as usize
+                {
+                    let struct_instance =
+                        unsafe { std::mem::zeroed::<typedef_struct>() };
+                    let struct_ptr = &struct_instance as *const typedef_struct;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
@@ -70,9 +76,15 @@
                 concat!("Alignment of ", stringify!(_bindgen_ty_1))
             );
             assert_eq!(
-                unsafe {
-                    &(*(::std::ptr::null::<_bindgen_ty_1>())).foo as *const _
-                        as usize
+                {
+                    let struct_instance =
+                        unsafe { std::mem::zeroed::<_bindgen_ty_1>() };
+                    let struct_ptr = &struct_instance as *const _bindgen_ty_1;
+                    let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+                    let struct_address = struct_ptr as usize;
+                    let field_address = field_ptr as usize;
+                    std::mem::forget(struct_instance);
+                    field_address.checked_sub(struct_address).unwrap()
                 },
                 0usize,
                 concat!(
diff --git a/tests/expectations/tests/struct_with_anon_struct.rs b/tests/expectations/tests/struct_with_anon_struct.rs
index 0f5d3da..8e92421 100644
--- a/tests/expectations/tests/struct_with_anon_struct.rs
+++ b/tests/expectations/tests/struct_with_anon_struct.rs
@@ -29,8 +29,15 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -41,8 +48,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -66,7 +80,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/struct_with_anon_struct_array.rs b/tests/expectations/tests/struct_with_anon_struct_array.rs
index d5a5044..8136145 100644
--- a/tests/expectations/tests/struct_with_anon_struct_array.rs
+++ b/tests/expectations/tests/struct_with_anon_struct_array.rs
@@ -30,8 +30,15 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -42,8 +49,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -73,8 +87,15 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_2>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_2>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -85,8 +106,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_2>())).b as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_2>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -110,12 +138,28 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         16usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(baz))
     );
diff --git a/tests/expectations/tests/struct_with_anon_struct_pointer.rs b/tests/expectations/tests/struct_with_anon_struct_pointer.rs
index 0ed19f7..b50afa8 100644
--- a/tests/expectations/tests/struct_with_anon_struct_pointer.rs
+++ b/tests/expectations/tests/struct_with_anon_struct_pointer.rs
@@ -29,8 +29,15 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -41,8 +48,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -66,7 +80,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/struct_with_anon_union.rs b/tests/expectations/tests/struct_with_anon_union.rs
index 15b8c9e..99b5aba 100644
--- a/tests/expectations/tests/struct_with_anon_union.rs
+++ b/tests/expectations/tests/struct_with_anon_union.rs
@@ -28,30 +28,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -75,7 +51,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/struct_with_anon_union_1_0.rs b/tests/expectations/tests/struct_with_anon_union_1_0.rs
index b02c444..8321eca 100644
--- a/tests/expectations/tests/struct_with_anon_union_1_0.rs
+++ b/tests/expectations/tests/struct_with_anon_union_1_0.rs
@@ -72,30 +72,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -115,7 +91,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs
index 30751e7..806511a 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_struct.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_struct.rs
@@ -29,8 +29,15 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -41,8 +48,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union.rs b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
index 17a8357..5152951 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_union.rs
@@ -28,30 +28,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
diff --git a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
index f72abd2..c4ab43d 100644
--- a/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
+++ b/tests/expectations/tests/struct_with_anon_unnamed_union_1_0.rs
@@ -72,30 +72,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/struct_with_bitfields.rs b/tests/expectations/tests/struct_with_bitfields.rs
index 2e95726..cfa9069 100644
--- a/tests/expectations/tests/struct_with_bitfields.rs
+++ b/tests/expectations/tests/struct_with_bitfields.rs
@@ -113,7 +113,15 @@
         concat!("Alignment of ", stringify!(bitfield))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<bitfield>())).e as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<bitfield>() };
+            let struct_ptr = &struct_instance as *const bitfield;
+            let field_ptr = std::ptr::addr_of!(struct_instance.e);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/struct_with_derive_debug.rs b/tests/expectations/tests/struct_with_derive_debug.rs
index 721ba96..ed77c78 100644
--- a/tests/expectations/tests/struct_with_derive_debug.rs
+++ b/tests/expectations/tests/struct_with_derive_debug.rs
@@ -23,8 +23,14 @@
         concat!("Alignment of ", stringify!(LittleArray))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<LittleArray>())).a as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<LittleArray>() };
+            let struct_ptr = &struct_instance as *const LittleArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -53,7 +59,15 @@
         concat!("Alignment of ", stringify!(BigArray))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<BigArray>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<BigArray>() };
+            let struct_ptr = &struct_instance as *const BigArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -90,8 +104,15 @@
         concat!("Alignment of ", stringify!(WithLittleArray))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithLittleArray>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<WithLittleArray>() };
+            let struct_ptr = &struct_instance as *const WithLittleArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -120,8 +141,14 @@
         concat!("Alignment of ", stringify!(WithBigArray))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).a as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<WithBigArray>() };
+            let struct_ptr = &struct_instance as *const WithBigArray;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/struct_with_large_array.rs b/tests/expectations/tests/struct_with_large_array.rs
index 56179c2..7d544cf 100644
--- a/tests/expectations/tests/struct_with_large_array.rs
+++ b/tests/expectations/tests/struct_with_large_array.rs
@@ -23,8 +23,14 @@
         concat!("Alignment of ", stringify!(S))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<S>())).large_array as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<S>() };
+            let struct_ptr = &struct_instance as *const S;
+            let field_ptr = std::ptr::addr_of!(struct_instance.large_array);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/struct_with_nesting.rs b/tests/expectations/tests/struct_with_nesting.rs
index 7ced63e..97a495b 100644
--- a/tests/expectations/tests/struct_with_nesting.rs
+++ b/tests/expectations/tests/struct_with_nesting.rs
@@ -37,9 +37,17 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).c1
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -50,9 +58,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).c2
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -84,9 +100,17 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d1
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -97,9 +121,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d2
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1usize,
         concat!(
@@ -110,9 +142,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d3
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d3);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -123,9 +163,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d4
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d4);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         3usize,
         concat!(
@@ -148,18 +196,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -183,7 +219,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
     );
diff --git a/tests/expectations/tests/struct_with_nesting_1_0.rs b/tests/expectations/tests/struct_with_nesting_1_0.rs
index 9f27161..7720363 100644
--- a/tests/expectations/tests/struct_with_nesting_1_0.rs
+++ b/tests/expectations/tests/struct_with_nesting_1_0.rs
@@ -81,9 +81,17 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).c1
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -94,9 +102,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).c2
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_1>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -133,9 +149,17 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d1
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -146,9 +170,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d2
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1usize,
         concat!(
@@ -159,9 +191,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d3
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d3);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -172,9 +212,17 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).d4
-                as *const _ as usize
+        {
+            let struct_instance = unsafe {
+                std::mem::zeroed::<foo__bindgen_ty_1__bindgen_ty_2>()
+            };
+            let struct_ptr =
+                &struct_instance as *const foo__bindgen_ty_1__bindgen_ty_2;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d4);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         3usize,
         concat!(
@@ -202,18 +250,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -233,7 +269,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
     );
diff --git a/tests/expectations/tests/struct_with_packing.rs b/tests/expectations/tests/struct_with_packing.rs
index 14ee36f..e8c2cbc 100644
--- a/tests/expectations/tests/struct_with_packing.rs
+++ b/tests/expectations/tests/struct_with_packing.rs
@@ -24,12 +24,28 @@
         concat!("Alignment of ", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<a>() };
+            let struct_ptr = &struct_instance as *const a;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(a), "::", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<a>())).c as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<a>() };
+            let struct_ptr = &struct_instance as *const a;
+            let field_ptr = std::ptr::addr_of!(struct_instance.c);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         1usize,
         concat!("Offset of field: ", stringify!(a), "::", stringify!(c))
     );
diff --git a/tests/expectations/tests/struct_with_struct.rs b/tests/expectations/tests/struct_with_struct.rs
index c605c6e..37e7b37 100644
--- a/tests/expectations/tests/struct_with_struct.rs
+++ b/tests/expectations/tests/struct_with_struct.rs
@@ -29,8 +29,15 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).x as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -41,8 +48,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).y as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.y);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -66,7 +80,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
diff --git a/tests/expectations/tests/template.rs b/tests/expectations/tests/template.rs
index 9c48488..8672db6 100644
--- a/tests/expectations/tests/template.rs
+++ b/tests/expectations/tests/template.rs
@@ -78,13 +78,27 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mB as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mB);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(mB))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstPtr as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBConstPtr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -95,8 +109,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstStructPtr as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mBConstStructPtr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -107,9 +128,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstStructPtrArray as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mBConstStructPtrArray);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         24usize,
         concat!(
@@ -120,7 +147,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mBConst as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBConst);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         32usize,
         concat!(
             "Offset of field: ",
@@ -130,8 +165,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBVolatile as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBVolatile);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         36usize,
         concat!(
@@ -142,8 +183,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstBool as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBConstBool);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         40usize,
         concat!(
@@ -154,8 +201,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstChar as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBConstChar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         42usize,
         concat!(
@@ -166,7 +219,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mBArray as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBArray);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         44usize,
         concat!(
             "Offset of field: ",
@@ -176,8 +237,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBPtrArray as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBPtrArray);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         48usize,
         concat!(
@@ -188,8 +255,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBArrayPtr as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBArrayPtr);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         56usize,
         concat!(
@@ -200,13 +273,27 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mBRef as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBRef);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         64usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(mBRef))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<C>())).mBConstRef as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBConstRef);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         72usize,
         concat!(
@@ -217,7 +304,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mPtrRef as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mPtrRef);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         80usize,
         concat!(
             "Offset of field: ",
@@ -227,7 +322,15 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).mArrayRef as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mArrayRef);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         88usize,
         concat!(
             "Offset of field: ",
@@ -312,9 +415,15 @@
         concat!("Alignment of ", stringify!(RootedContainer))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<RootedContainer>())).root as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<RootedContainer>() };
+            let struct_ptr = &struct_instance as *const RootedContainer;
+            let field_ptr = std::ptr::addr_of!(struct_instance.root);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -368,9 +477,15 @@
         concat!("Alignment of ", stringify!(PODButContainsDtor))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<PODButContainsDtor>())).member as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<PODButContainsDtor>() };
+            let struct_ptr = &struct_instance as *const PODButContainsDtor;
+            let field_ptr = std::ptr::addr_of!(struct_instance.member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -414,8 +529,14 @@
         concat!("Alignment of ", stringify!(POD))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<POD>())).opaque_member as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<POD>() };
+            let struct_ptr = &struct_instance as *const POD;
+            let field_ptr = std::ptr::addr_of!(struct_instance.opaque_member);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/test_mixed_header_and_header_contents.rs b/tests/expectations/tests/test_mixed_header_and_header_contents.rs
index c97be9b..c230453 100644
--- a/tests/expectations/tests/test_mixed_header_and_header_contents.rs
+++ b/tests/expectations/tests/test_mixed_header_and_header_contents.rs
@@ -44,52 +44,142 @@
         concat!("Alignment of ", stringify!(Test))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).ch as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).u as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         1usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).d as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         2usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cch as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         3usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cu as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cu);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cd as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         5usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cch as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Cch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         6usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cu as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Cu);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         7usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cd as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Cd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccch as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ccch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         9usize,
         concat!(
             "Offset of field: ",
@@ -99,12 +189,30 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccu as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ccu);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         10usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccd as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ccd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         11usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd))
     );
diff --git a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs
index c77c183..2ac3c4f 100644
--- a/tests/expectations/tests/test_multiple_header_calls_in_builder.rs
+++ b/tests/expectations/tests/test_multiple_header_calls_in_builder.rs
@@ -38,52 +38,142 @@
         concat!("Alignment of ", stringify!(Test))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).ch as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.ch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(ch))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).u as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.u);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         1usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(u))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).d as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.d);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         2usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(d))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cch as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         3usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(cch))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cu as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cu);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(cu))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).cd as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.cd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         5usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(cd))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cch as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Cch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         6usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cch))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cu as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Cu);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         7usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cu))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Cd as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Cd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Cd))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccch as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ccch);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         9usize,
         concat!(
             "Offset of field: ",
@@ -93,12 +183,30 @@
         )
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccu as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ccu);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         10usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccu))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Test>())).Ccd as *const _ as usize },
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<Test>() };
+            let struct_ptr = &struct_instance as *const Test;
+            let field_ptr = std::ptr::addr_of!(struct_instance.Ccd);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         11usize,
         concat!("Offset of field: ", stringify!(Test), "::", stringify!(Ccd))
     );
diff --git a/tests/expectations/tests/timex.rs b/tests/expectations/tests/timex.rs
index b2a84d8..53052b0 100644
--- a/tests/expectations/tests/timex.rs
+++ b/tests/expectations/tests/timex.rs
@@ -111,7 +111,15 @@
         concat!("Alignment of ", stringify!(timex))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<timex>())).tai as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<timex>() };
+            let struct_ptr = &struct_instance as *const timex;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tai);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
@@ -150,8 +158,14 @@
         concat!("Alignment of ", stringify!(timex_named))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<timex_named>())).tai as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<timex_named>() };
+            let struct_ptr = &struct_instance as *const timex_named;
+            let field_ptr = std::ptr::addr_of!(struct_instance.tai);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/type-referenced-by-allowlisted-function.rs b/tests/expectations/tests/type-referenced-by-allowlisted-function.rs
index 568f943..ce0d983 100644
--- a/tests/expectations/tests/type-referenced-by-allowlisted-function.rs
+++ b/tests/expectations/tests/type-referenced-by-allowlisted-function.rs
@@ -23,8 +23,14 @@
         concat!("Alignment of ", stringify!(dl_phdr_info))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dl_phdr_info>())).x as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<dl_phdr_info>() };
+            let struct_ptr = &struct_instance as *const dl_phdr_info;
+            let field_ptr = std::ptr::addr_of!(struct_instance.x);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
diff --git a/tests/expectations/tests/typeref.rs b/tests/expectations/tests/typeref.rs
index 1c34be7..cd91335 100644
--- a/tests/expectations/tests/typeref.rs
+++ b/tests/expectations/tests/typeref.rs
@@ -23,9 +23,15 @@
         concat!("Alignment of ", stringify!(mozilla_FragmentOrURL))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mozilla_FragmentOrURL>())).mIsLocalRef
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<mozilla_FragmentOrURL>() };
+            let struct_ptr = &struct_instance as *const mozilla_FragmentOrURL;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mIsLocalRef);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -99,7 +105,15 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).mFoo as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mFoo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(mFoo))
     );
@@ -130,7 +144,15 @@
         concat!("Alignment of ", stringify!(nsFoo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<nsFoo>())).mBar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<nsFoo>() };
+            let struct_ptr = &struct_instance as *const nsFoo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/typeref_1_0.rs b/tests/expectations/tests/typeref_1_0.rs
index 2820d9f..a7e7cf2 100644
--- a/tests/expectations/tests/typeref_1_0.rs
+++ b/tests/expectations/tests/typeref_1_0.rs
@@ -66,9 +66,15 @@
         concat!("Alignment of ", stringify!(mozilla_FragmentOrURL))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<mozilla_FragmentOrURL>())).mIsLocalRef
-                as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<mozilla_FragmentOrURL>() };
+            let struct_ptr = &struct_instance as *const mozilla_FragmentOrURL;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mIsLocalRef);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -137,7 +143,15 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).mFoo as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mFoo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(Bar), "::", stringify!(mFoo))
     );
@@ -174,7 +188,15 @@
         concat!("Alignment of ", stringify!(nsFoo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<nsFoo>())).mBar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<nsFoo>() };
+            let struct_ptr = &struct_instance as *const nsFoo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mBar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/underscore.rs b/tests/expectations/tests/underscore.rs
index 6ef2d8a..f79c8bb 100644
--- a/tests/expectations/tests/underscore.rs
+++ b/tests/expectations/tests/underscore.rs
@@ -24,7 +24,15 @@
         concat!("Alignment of ", stringify!(ptr_t))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<ptr_t>())).__ as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<ptr_t>() };
+            let struct_ptr = &struct_instance as *const ptr_t;
+            let field_ptr = std::ptr::addr_of!(struct_instance.__);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(ptr_t), "::", stringify!(__))
     );
diff --git a/tests/expectations/tests/union-align.rs b/tests/expectations/tests/union-align.rs
index 8612764..c28a685 100644
--- a/tests/expectations/tests/union-align.rs
+++ b/tests/expectations/tests/union-align.rs
@@ -23,11 +23,6 @@
         16usize,
         concat!("Alignment of ", stringify!(Bar))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).foo as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Bar), "::", stringify!(foo))
-    );
 }
 impl Default for Bar {
     fn default() -> Self {
@@ -56,11 +51,6 @@
         16usize,
         concat!("Alignment of ", stringify!(Baz))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Baz>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(Baz), "::", stringify!(bar))
-    );
 }
 impl Default for Baz {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union-in-ns.rs b/tests/expectations/tests/union-in-ns.rs
index b52c6c3..d5fae0c 100644
--- a/tests/expectations/tests/union-in-ns.rs
+++ b/tests/expectations/tests/union-in-ns.rs
@@ -26,16 +26,6 @@
             4usize,
             concat!("Alignment of ", stringify!(bar))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<bar>())).baz as *const _ as usize },
-            0usize,
-            concat!(
-                "Offset of field: ",
-                stringify!(bar),
-                "::",
-                stringify!(baz)
-            )
-        );
     }
     impl Default for bar {
         fn default() -> Self {
diff --git a/tests/expectations/tests/union-in-ns_1_0.rs b/tests/expectations/tests/union-in-ns_1_0.rs
index c210c38..5c7e60b 100644
--- a/tests/expectations/tests/union-in-ns_1_0.rs
+++ b/tests/expectations/tests/union-in-ns_1_0.rs
@@ -73,16 +73,6 @@
             4usize,
             concat!("Alignment of ", stringify!(bar))
         );
-        assert_eq!(
-            unsafe { &(*(::std::ptr::null::<bar>())).baz as *const _ as usize },
-            0usize,
-            concat!(
-                "Offset of field: ",
-                stringify!(bar),
-                "::",
-                stringify!(baz)
-            )
-        );
     }
     impl Clone for bar {
         fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_dtor.rs b/tests/expectations/tests/union_dtor.rs
index 94ad3fd..6fe939f 100644
--- a/tests/expectations/tests/union_dtor.rs
+++ b/tests/expectations/tests/union_dtor.rs
@@ -22,30 +22,6 @@
         8usize,
         concat!("Alignment of ", stringify!(UnionWithDtor))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UnionWithDtor>())).mFoo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UnionWithDtor),
-            "::",
-            stringify!(mFoo)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UnionWithDtor>())).mBar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UnionWithDtor),
-            "::",
-            stringify!(mBar)
-        )
-    );
 }
 extern "C" {
     #[link_name = "\u{1}_ZN13UnionWithDtorD1Ev"]
diff --git a/tests/expectations/tests/union_dtor_1_0.rs b/tests/expectations/tests/union_dtor_1_0.rs
index a59f99f..6e16a4e 100644
--- a/tests/expectations/tests/union_dtor_1_0.rs
+++ b/tests/expectations/tests/union_dtor_1_0.rs
@@ -67,30 +67,6 @@
         8usize,
         concat!("Alignment of ", stringify!(UnionWithDtor))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UnionWithDtor>())).mFoo as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UnionWithDtor),
-            "::",
-            stringify!(mFoo)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<UnionWithDtor>())).mBar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(UnionWithDtor),
-            "::",
-            stringify!(mBar)
-        )
-    );
 }
 extern "C" {
     #[link_name = "\u{1}_ZN13UnionWithDtorD1Ev"]
diff --git a/tests/expectations/tests/union_fields.rs b/tests/expectations/tests/union_fields.rs
index 6cd0d56..b2b1be6 100644
--- a/tests/expectations/tests/union_fields.rs
+++ b/tests/expectations/tests/union_fields.rs
@@ -24,43 +24,6 @@
         8usize,
         concat!("Alignment of ", stringify!(nsStyleUnion))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mInt as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mInt)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mFloat as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mFloat)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mPointer as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mPointer)
-        )
-    );
 }
 impl Default for nsStyleUnion {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_fields_1_0.rs b/tests/expectations/tests/union_fields_1_0.rs
index 36972b6..d239936 100644
--- a/tests/expectations/tests/union_fields_1_0.rs
+++ b/tests/expectations/tests/union_fields_1_0.rs
@@ -68,43 +68,6 @@
         8usize,
         concat!("Alignment of ", stringify!(nsStyleUnion))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mInt as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mInt)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mFloat as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mFloat)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<nsStyleUnion>())).mPointer as *const _
-                as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(nsStyleUnion),
-            "::",
-            stringify!(mPointer)
-        )
-    );
 }
 impl Clone for nsStyleUnion {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_struct.rs b/tests/expectations/tests/union_with_anon_struct.rs
index afb7350..b34c53a 100644
--- a/tests/expectations/tests/union_with_anon_struct.rs
+++ b/tests/expectations/tests/union_with_anon_struct.rs
@@ -29,8 +29,15 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -41,8 +48,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -65,11 +79,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_struct_1_0.rs b/tests/expectations/tests/union_with_anon_struct_1_0.rs
index 09dcfa1..f69761e 100644
--- a/tests/expectations/tests/union_with_anon_struct_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_struct_1_0.rs
@@ -73,8 +73,15 @@
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -85,8 +92,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<foo__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const foo__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -114,11 +128,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield.rs b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
index 09ed515..9036d89 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield.rs
@@ -174,11 +174,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
index 43736b0..6dec77a 100644
--- a/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_struct_bitfield_1_0.rs
@@ -223,11 +223,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_union.rs b/tests/expectations/tests/union_with_anon_union.rs
index a24962c..5c9507f 100644
--- a/tests/expectations/tests/union_with_anon_union.rs
+++ b/tests/expectations/tests/union_with_anon_union.rs
@@ -28,30 +28,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -74,11 +50,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_union_1_0.rs b/tests/expectations/tests/union_with_anon_union_1_0.rs
index f892c45..55e2cce 100644
--- a/tests/expectations/tests/union_with_anon_union_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_union_1_0.rs
@@ -73,30 +73,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -115,11 +91,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).bar as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
-    );
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct.rs b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
index 94380d1..b0c5773 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct.rs
@@ -32,9 +32,15 @@
         concat!("Alignment of ", stringify!(pixel__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).r as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<pixel__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const pixel__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.r);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -45,9 +51,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).g as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<pixel__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const pixel__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.g);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1usize,
         concat!(
@@ -58,9 +70,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).b as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<pixel__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const pixel__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -71,9 +89,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<pixel__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const pixel__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         3usize,
         concat!(
@@ -96,16 +120,6 @@
         4usize,
         concat!("Alignment of ", stringify!(pixel))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<pixel>())).rgba as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel),
-            "::",
-            stringify!(rgba)
-        )
-    );
 }
 impl Default for pixel {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
index cbdac70..5f97be7 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_struct_1_0.rs
@@ -76,9 +76,15 @@
         concat!("Alignment of ", stringify!(pixel__bindgen_ty_1))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).r as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<pixel__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const pixel__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.r);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -89,9 +95,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).g as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<pixel__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const pixel__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.g);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         1usize,
         concat!(
@@ -102,9 +114,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).b as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<pixel__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const pixel__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         2usize,
         concat!(
@@ -115,9 +133,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<pixel__bindgen_ty_1>())).a as *const _
-                as usize
+        {
+            let struct_instance =
+                unsafe { std::mem::zeroed::<pixel__bindgen_ty_1>() };
+            let struct_ptr = &struct_instance as *const pixel__bindgen_ty_1;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         3usize,
         concat!(
@@ -145,16 +169,6 @@
         4usize,
         concat!("Alignment of ", stringify!(pixel))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<pixel>())).rgba as *const _ as usize },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(pixel),
-            "::",
-            stringify!(rgba)
-        )
-    );
 }
 impl Clone for pixel {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union.rs b/tests/expectations/tests/union_with_anon_unnamed_union.rs
index 2004ff4..ee65143 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_union.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_union.rs
@@ -29,30 +29,6 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).c as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(c)
-        )
-    );
 }
 impl Default for foo__bindgen_ty_1 {
     fn default() -> Self {
@@ -75,11 +51,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
index 910f588..0ea64ff 100644
--- a/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
+++ b/tests/expectations/tests/union_with_anon_unnamed_union_1_0.rs
@@ -74,30 +74,6 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(b)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1>())).c as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1),
-            "::",
-            stringify!(c)
-        )
-    );
 }
 impl Clone for foo__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -116,11 +92,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_big_member.rs b/tests/expectations/tests/union_with_big_member.rs
index 3f9294d..5aac1ce 100644
--- a/tests/expectations/tests/union_with_big_member.rs
+++ b/tests/expectations/tests/union_with_big_member.rs
@@ -23,30 +23,6 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for WithBigArray {
     fn default() -> Self {
@@ -75,30 +51,6 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigArray2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray2>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray2>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray2),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for WithBigArray2 {
     fn default() -> Self {
@@ -127,30 +79,6 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigMember))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigMember>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigMember),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigMember>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigMember),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Default for WithBigMember {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_big_member_1_0.rs b/tests/expectations/tests/union_with_big_member_1_0.rs
index 541c9d4..c9da6a6 100644
--- a/tests/expectations/tests/union_with_big_member_1_0.rs
+++ b/tests/expectations/tests/union_with_big_member_1_0.rs
@@ -67,30 +67,6 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigArray))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Clone for WithBigArray {
     fn clone(&self) -> Self {
@@ -125,30 +101,6 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigArray2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray2>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray2),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigArray2>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigArray2),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Clone for WithBigArray2 {
     fn clone(&self) -> Self {
@@ -174,30 +126,6 @@
         4usize,
         concat!("Alignment of ", stringify!(WithBigMember))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigMember>())).a as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigMember),
-            "::",
-            stringify!(a)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<WithBigMember>())).b as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(WithBigMember),
-            "::",
-            stringify!(b)
-        )
-    );
 }
 impl Clone for WithBigMember {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/union_with_nesting.rs b/tests/expectations/tests/union_with_nesting.rs
index 54a3179..bb5038a 100644
--- a/tests/expectations/tests/union_with_nesting.rs
+++ b/tests/expectations/tests/union_with_nesting.rs
@@ -35,32 +35,6 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).b1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).b2
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b2)
-        )
-    );
 }
 impl Default for foo__bindgen_ty_1__bindgen_ty_1 {
     fn default() -> Self {
@@ -89,32 +63,6 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).c1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(c1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).c2
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(c2)
-        )
-    );
 }
 impl Default for foo__bindgen_ty_1__bindgen_ty_2 {
     fn default() -> Self {
@@ -159,11 +107,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
 }
 impl Default for foo {
     fn default() -> Self {
diff --git a/tests/expectations/tests/union_with_nesting_1_0.rs b/tests/expectations/tests/union_with_nesting_1_0.rs
index 3f105c3..86ad0a2 100644
--- a/tests/expectations/tests/union_with_nesting_1_0.rs
+++ b/tests/expectations/tests/union_with_nesting_1_0.rs
@@ -80,32 +80,6 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).b1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_1>())).b2
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_1),
-            "::",
-            stringify!(b2)
-        )
-    );
 }
 impl Clone for foo__bindgen_ty_1__bindgen_ty_1 {
     fn clone(&self) -> Self {
@@ -131,32 +105,6 @@
         2usize,
         concat!("Alignment of ", stringify!(foo__bindgen_ty_1__bindgen_ty_2))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).c1
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(c1)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<foo__bindgen_ty_1__bindgen_ty_2>())).c2
-                as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(foo__bindgen_ty_1__bindgen_ty_2),
-            "::",
-            stringify!(c2)
-        )
-    );
 }
 impl Clone for foo__bindgen_ty_1__bindgen_ty_2 {
     fn clone(&self) -> Self {
@@ -193,11 +141,6 @@
         4usize,
         concat!("Alignment of ", stringify!(foo))
     );
-    assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).a as *const _ as usize },
-        0usize,
-        concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
-    );
 }
 impl Clone for foo {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/unknown_attr.rs b/tests/expectations/tests/unknown_attr.rs
index 8dbda00..108094d 100644
--- a/tests/expectations/tests/unknown_attr.rs
+++ b/tests/expectations/tests/unknown_attr.rs
@@ -26,9 +26,15 @@
         concat!("Alignment of ", stringify!(max_align_t))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<max_align_t>())).__clang_max_align_nonce1
-                as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<max_align_t>() };
+            let struct_ptr = &struct_instance as *const max_align_t;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.__clang_max_align_nonce1);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -39,9 +45,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<max_align_t>())).__clang_max_align_nonce2
-                as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<max_align_t>() };
+            let struct_ptr = &struct_instance as *const max_align_t;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.__clang_max_align_nonce2);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
diff --git a/tests/expectations/tests/use-core.rs b/tests/expectations/tests/use-core.rs
index d919b6e..006a98b 100644
--- a/tests/expectations/tests/use-core.rs
+++ b/tests/expectations/tests/use-core.rs
@@ -27,17 +27,41 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
@@ -69,30 +93,6 @@
         8usize,
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<_bindgen_ty_1>())).bar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(bar)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<_bindgen_ty_1>())).baz as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(baz)
-        )
-    );
 }
 impl Default for _bindgen_ty_1 {
     fn default() -> Self {
diff --git a/tests/expectations/tests/use-core_1_0.rs b/tests/expectations/tests/use-core_1_0.rs
index 61ddfc4..c0cb163 100644
--- a/tests/expectations/tests/use-core_1_0.rs
+++ b/tests/expectations/tests/use-core_1_0.rs
@@ -70,17 +70,41 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).a as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.a);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(a))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).b as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.b);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         4usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(b))
     );
     assert_eq!(
-        unsafe { &(*(::core::ptr::null::<foo>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(foo), "::", stringify!(bar))
     );
@@ -118,30 +142,6 @@
         8usize,
         concat!("Alignment of ", stringify!(_bindgen_ty_1))
     );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<_bindgen_ty_1>())).bar as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(bar)
-        )
-    );
-    assert_eq!(
-        unsafe {
-            &(*(::core::ptr::null::<_bindgen_ty_1>())).baz as *const _ as usize
-        },
-        0usize,
-        concat!(
-            "Offset of field: ",
-            stringify!(_bindgen_ty_1),
-            "::",
-            stringify!(baz)
-        )
-    );
 }
 impl Clone for _bindgen_ty_1 {
     fn clone(&self) -> Self {
diff --git a/tests/expectations/tests/var-tracing.rs b/tests/expectations/tests/var-tracing.rs
index 2931f91..63962c4 100644
--- a/tests/expectations/tests/var-tracing.rs
+++ b/tests/expectations/tests/var-tracing.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(Bar))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<Bar>())).m_baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Bar>() };
+            let struct_ptr = &struct_instance as *const Bar;
+            let field_ptr = std::ptr::addr_of!(struct_instance.m_baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/vector.rs b/tests/expectations/tests/vector.rs
index 04f4de7..246313b 100644
--- a/tests/expectations/tests/vector.rs
+++ b/tests/expectations/tests/vector.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(foo))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<foo>())).mMember as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<foo>() };
+            let struct_ptr = &struct_instance as *const foo;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mMember);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!(
             "Offset of field: ",
diff --git a/tests/expectations/tests/virtual_inheritance.rs b/tests/expectations/tests/virtual_inheritance.rs
index eac6aa6..e3db231 100644
--- a/tests/expectations/tests/virtual_inheritance.rs
+++ b/tests/expectations/tests/virtual_inheritance.rs
@@ -23,7 +23,15 @@
         concat!("Alignment of ", stringify!(A))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<A>())).foo as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<A>() };
+            let struct_ptr = &struct_instance as *const A;
+            let field_ptr = std::ptr::addr_of!(struct_instance.foo);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         0usize,
         concat!("Offset of field: ", stringify!(A), "::", stringify!(foo))
     );
@@ -49,7 +57,15 @@
         concat!("Alignment of ", stringify!(B))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<B>())).bar as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<B>() };
+            let struct_ptr = &struct_instance as *const B;
+            let field_ptr = std::ptr::addr_of!(struct_instance.bar);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(B), "::", stringify!(bar))
     );
@@ -84,7 +100,15 @@
         concat!("Alignment of ", stringify!(C))
     );
     assert_eq!(
-        unsafe { &(*(::std::ptr::null::<C>())).baz as *const _ as usize },
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<C>() };
+            let struct_ptr = &struct_instance as *const C;
+            let field_ptr = std::ptr::addr_of!(struct_instance.baz);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
+        },
         8usize,
         concat!("Offset of field: ", stringify!(C), "::", stringify!(baz))
     );
diff --git a/tests/expectations/tests/weird_bitfields.rs b/tests/expectations/tests/weird_bitfields.rs
index c4dfa55..f9e21ca 100644
--- a/tests/expectations/tests/weird_bitfields.rs
+++ b/tests/expectations/tests/weird_bitfields.rs
@@ -132,9 +132,15 @@
         concat!("Alignment of ", stringify!(Weird))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mStrokeDasharrayLength as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mStrokeDasharrayLength);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -145,8 +151,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mClipRule as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mClipRule);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(
@@ -157,9 +169,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mColorInterpolation as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mColorInterpolation);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         9usize,
         concat!(
@@ -170,9 +188,15 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mColorInterpolationFilters
-                as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr =
+                std::ptr::addr_of!(struct_instance.mColorInterpolationFilters);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         10usize,
         concat!(
@@ -183,8 +207,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mFillRule as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mFillRule);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         11usize,
         concat!(
@@ -195,9 +225,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mImageRendering as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mImageRendering);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         12usize,
         concat!(
@@ -208,8 +243,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mPaintOrder as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mPaintOrder);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         13usize,
         concat!(
@@ -220,9 +261,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mShapeRendering as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mShapeRendering);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         14usize,
         concat!(
@@ -233,9 +279,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mStrokeLinecap as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mStrokeLinecap);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         15usize,
         concat!(
@@ -246,9 +297,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mStrokeLinejoin as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mStrokeLinejoin);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         16usize,
         concat!(
@@ -259,8 +315,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mTextAnchor as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mTextAnchor);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         17usize,
         concat!(
@@ -271,9 +333,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<Weird>())).mTextRendering as *const _
-                as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<Weird>() };
+            let struct_ptr = &struct_instance as *const Weird;
+            let field_ptr = std::ptr::addr_of!(struct_instance.mTextRendering);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         18usize,
         concat!(
diff --git a/tests/expectations/tests/zero-size-array-align.rs b/tests/expectations/tests/zero-size-array-align.rs
index 92b6798..842e1e3 100644
--- a/tests/expectations/tests/zero-size-array-align.rs
+++ b/tests/expectations/tests/zero-size-array-align.rs
@@ -55,8 +55,14 @@
         concat!("Alignment of ", stringify!(dm_deps))
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dm_deps>())).count as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<dm_deps>() };
+            let struct_ptr = &struct_instance as *const dm_deps;
+            let field_ptr = std::ptr::addr_of!(struct_instance.count);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         0usize,
         concat!(
@@ -67,8 +73,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dm_deps>())).filler as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<dm_deps>() };
+            let struct_ptr = &struct_instance as *const dm_deps;
+            let field_ptr = std::ptr::addr_of!(struct_instance.filler);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         4usize,
         concat!(
@@ -79,8 +91,14 @@
         )
     );
     assert_eq!(
-        unsafe {
-            &(*(::std::ptr::null::<dm_deps>())).device as *const _ as usize
+        {
+            let struct_instance = unsafe { std::mem::zeroed::<dm_deps>() };
+            let struct_ptr = &struct_instance as *const dm_deps;
+            let field_ptr = std::ptr::addr_of!(struct_instance.device);
+            let struct_address = struct_ptr as usize;
+            let field_address = field_ptr as usize;
+            std::mem::forget(struct_instance);
+            field_address.checked_sub(struct_address).unwrap()
         },
         8usize,
         concat!(