src/arch/i386/boot/coreboot_table.c: In function 'write_coreboot_table': src/arch/i386/boot/coreboot_table.c:492: warning: dereferencing pointer 'rec_src' does break strict-aliasing rules src/arch/i386/boot/coreboot_table.c:491: note: initialized from here
#if (CONFIG_HAVE_OPTION_TABLE == 1) { struct lb_record *rec_dest, *rec_src; /* Write the option config table... */ rec_dest = lb_new_record(head); rec_src = (struct lb_record *)(void *)&option_table; memcpy(rec_dest, rec_src, rec_src->size); /* Create cmos checksum entry in coreboot table */ lb_cmos_checksum(head); } #endif
from option_table.c: unsigned char option_table[] = { 0xc8,0x00,0x00,0x00,0x88,0x04,0x00,0x00,0x0c,0x00, ...
from src/include/boot/coreboot_tables.h: struct lb_record { uint32_t tag; /* tag ID */ uint32_t size; /* size of record (in bytes) */ };
Why are we casting it as a lb_record * then using that size field in the copy?
Thanks, Myles