From 98cc02fd0509cc299cef0358adec4030e98e77fc Mon Sep 17 00:00:00 2001 From: yidong0635 Date: Wed, 19 Jun 2019 06:00:13 -0400 Subject: [PATCH] identify: Fix gcc9 unaligned warning. Warning: taking address of packed member of 'struct spdk_nvme_health_information_page' and 'spdk_nvme_ctrlr_data' may result in an unaligned pointer value [-Waddress-of-packed-member] So add __attribute__((aligned)) following with __attribute__((packed)) to avoid this kind of GCC9 warning. This related to issue #822. Change-Id: I6117c1e50a137d29cd60ebbad5c15d9093d21670 Signed-off-by: yidong0635 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458535 Tested-by: SPDK CI Jenkins Reviewed-by: Karol Latecki Reviewed-by: Changpeng Liu Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker --- include/spdk/nvme_spec.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/spdk/nvme_spec.h b/include/spdk/nvme_spec.h index 9b05304ac..fbb4d7448 100644 --- a/include/spdk/nvme_spec.h +++ b/include/spdk/nvme_spec.h @@ -935,7 +935,7 @@ enum spdk_nvme_flush_broadcast { SPDK_NVME_FLUSH_BROADCAST_SUPPORTED = 3 }; -struct __attribute__((packed)) spdk_nvme_ctrlr_data { +struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_ctrlr_data { /* bytes 0-255: controller capabilities and features */ /** pci vendor id */ @@ -1853,7 +1853,7 @@ SPDK_STATIC_ASSERT(sizeof(union spdk_nvme_critical_warning_state) == 1, "Incorre /** * SMART / health information page (\ref SPDK_NVME_LOG_HEALTH_INFORMATION) */ -struct __attribute__((packed)) spdk_nvme_health_information_page { +struct __attribute__((packed)) __attribute__((aligned)) spdk_nvme_health_information_page { union spdk_nvme_critical_warning_state critical_warning; uint16_t temperature;