[SLOF] [PATCH] Fix remaining compiler warnings in sloffs.c

Thomas Huth thuth at redhat.com
Mon Aug 8 16:38:33 AEST 2016


On 08.08.2016 03:30, Segher Boessenkool wrote:
> On Fri, Aug 05, 2016 at 10:48:18AM +0200, Adrian Reber wrote:
>>> +static void print_header_date(void *dptr)
>>> +{
>>> +	uint8_t *date = dptr;
>>> +
>>> +	if (*(uint64_t *)dptr != 0) {
> 
> This is the exact same problem though.  Should be something like
> 
> 	if (date[0] || date[1] || date[2] || date[3]
> 	    || date[4] || date[5] || date[6] || date[7])

I'm now type-punning dptr here, not date, so this time it's a void
pointer instead of a char array ... and I thought type-punning a void
pointer would be OK since they are considered to alias any other kind of
data? I might be wrong here, though, these aliasing problems always
cause a headache for me.

In the end, we just might want to add -fno-strict-aliasing to the
HOSTCFLAGS, just like we already did it in make.rules for the normal
CFLAGS, and call it a day.
(But IMHO it makes sense to include this patch here anyway since it
consolidates the date printing a little bit)

 Thomas



More information about the SLOF mailing list