ndctl icon indicating copy to clipboard operation
ndctl copied to clipboard

compiler warning: taking address of packed member of a structure

Open joylatten opened this issue 5 years ago • 1 comments

gcc version 9.2.1 reports warnings about possible unaligned pointer values when compiling ndctl. i.e., intel.c: In function ‘intel_dimm_cmd_new_smart_threshold’: intel.c:272:25: warning: taking address of packed member of ‘struct nd_intel_smart_threshold’ may result in an unaligned pointer value [-Waddress-of-packed-member] 272 | cmd->firmware_status = &cmd->intel->thresh.status; | ^~~~~~~~~~~~~~~~~~~~~~~~~~ intel.c: In function ‘intel_dimm_cmd_new_smart_set_threshold’: intel.c:302:25: warning: taking address of packed member of ‘struct nd_intel_smart_set_threshold’ may result in an unaligned pointer value [-Waddress-of-packed-member] 302 | cmd->firmware_status = &set_thresh->status; | ^~~~~~~~~~~~~~~~~~~ intel.c: In function ‘intel_new_smart_inject’: intel.c:363:25: warning: taking address of packed member of ‘struct nd_intel_smart_inject’ may result in an unaligned pointer value [-Waddress-of-packed-member] 363 | cmd->firmware_status = &cmd->intel->inject.status; | ^~~~~~~~~~~~~~~~~~~~~~~~~~ intel.c: In function ‘intel_dimm_cmd_new_fw_get_info’: intel.c:471:25: warning: taking address of packed member of ‘struct nd_intel_fw_info’ may result in an unaligned pointer value [-Waddress-of-packed-member] 471 | cmd->firmware_status = &cmd->intel->info.status; | ^~~~~~~~~~~~~~~~~~~~~~~~ intel.c: In function ‘intel_dimm_cmd_new_fw_start’: intel.c:543:25: warning: taking address of packed member of ‘struct nd_intel_fw_start’ may result in an unaligned pointer value [-Waddress-of-packed-member] 543 | cmd->firmware_status = &cmd->intel->start.status; | ^~~~~~~~~~~~~~~~~~~~~~~~~

This may impact performance on some architectures and possibly not work on others.

joylatten avatar Jan 23 '20 15:01 joylatten

Should be fixed since v68

hramrach avatar Jan 14 '22 14:01 hramrach