Dan Williams <dan.j.williams(a)intel.com> writes:
gcc 9.1.1 emits a slew of warnings for many of the command field
accesses. I.e. warnings of the form:
libndctl.c:2586:21: warning: taking address of packed member of ‘struct
nd_cmd_get_config_data_hdr’ may result in an unaligned pointer value
[-Waddress-of-packed-member]
2586 | cmd->iter.offset = &cmd->get_data->in_offset;
| ^~~~~~~~~~~~~~~~~~~~~~~~~
Suppress these as fixing the warning would defeat the abstraction of being able
to have common code that operates on commands with common fields at different
offsets in the payload.
As I understand it, taking a pointer to this potentially unaligned
member can result in bus errors (or worse, accessing wrong data) on
architectures that don't support unaligned accesses. I'd be a whole lot
happier with this changelog if it mentioned that you had considered what
the warning actually meant, and decided it didn't matter for the
architectures you want to support.
x86 is, of course, safe. I believe aarch64 is, as well. I didn't look
into others.
Cheers,
Jeff
Signed-off-by: Dan Williams <dan.j.williams(a)intel.com>
---
configure.ac | 1 +
1 file changed, 1 insertion(+)
diff --git a/configure.ac b/configure.ac
index 4737cfff77f2..79f82977fa44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -214,6 +214,7 @@ my_CFLAGS="\
-Wmaybe-uninitialized \
-Wdeclaration-after-statement \
-Wunused-result \
+-Wno-address-of-packed-member \
-D_FORTIFY_SOURCE=2 \
-O2
"
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm(a)lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm