This has the nice side effect to remove the compiler warning "dereferencing type-punned pointer will break strict-aliasing rules" which occur since gcc-4.7. There are 79 locations where the warning occurs. All of them are in statements where the htonl/htons/ntohl/ntohs functions are used, e.g.: in lib/pdu.c itt = ntohl(*(uint32_t *)&in->hdr[16]); in lib/scsi-lowlevel.c *(uint32_t *)&task->cdb[2] = htonl(lba); The warning is not related to the htonl/htons/ntohl/ntohs functions but to the casting/dereferencing operation. If the dereferenced variable is already a pointer, the warning does not not occur, e.g. this one: in lib/pdu.c itt = ntohl(*(uint32_t *)&in->data[16]); The warning is caused by the -fstrict-aliasing option. The -fstrict-aliasing option is enabled at optimization levels -O2, -O3, -Os. Signed-off-by: Bernhard Kohl <bernhard.kohl@gmx.net>
3.9 KiB
3.9 KiB