Re: [BUG] Argument-alignment build error with clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 23, 2024 at 03:26:57PM -0700, Paul E. McKenney wrote:
> Hello!
> 
> Running rcutorture on next-20241023 got me lots of these:
> 
> drivers/acpi/prmt.c:156:29: error: passing 1-byte aligned argument to 4-byte aligned parameter 1 of 'efi_pa_va_lookup' may result in an unaligned pointer access [-Werror,-Walign-mismatch]
>           156 |                         (void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
> 
> This is built with CC=clang.  I don't see this diagnostic with GCC.
> But we are supposed to be able to build with clang, so...

Ah, and this might help:

clang version 18.1.8 (CentOS 18.1.8-3.el9)

							Thanx, Paul

> The first argument is the address of one of these:
> 
> typedef struct {
> 	__u8 b[UUID_SIZE];
> } guid_t;
> 
> Where UUID_SIZE is as follows:
> 
> #define UUID_SIZE 16
> 
> But this guid_t is a member of one of these:
> 
> struct prm_handler_info {
> 	guid_t guid;
> 	efi_status_t (__efiapi *handler_addr)(u64, void *);
> 	u64 static_data_buffer_addr;
> 	u64 acpi_param_buffer_addr;
> 
> 	struct list_head handler_list;
> };
> 
> One can argue that this structure must be 16-bit aligned on a
> 64-bit build.  So maybe this is a bug in clang's diagnostics, hence
> linux-toolchains on CC.
> 
> Thoughts?
> 
> 						Thanx, Paul
> 




[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux