Compiling sfccommon leads to lots of compiler warnings when compiling sfcUtil/genericlist.c
i.e.
sfcUtil/genericlist.c: In function 'listRelease':
sfcUtil/genericlist.c:556:3: warning: dereferencing type-punned pointer will break strict-aliasing rules
Patch follows ...
> Patch follows ...
Did you forget to attach it?
Also, I'm not seeing this warning when I compile. What gcc version are you using? I have 4.4.4 here.
Ah, sorry, the patch is not ready yet.
Compiler is gcc 4.5.1 with "-Wall"
Adapting summary to reflect root cause of the problem.
e.g. newList() does
UtilList ul;
initialize_list((Generic_list *) & ul.hdl);
and then initialize_list() continues with
list->info = ...
- the call to initialize_list casts a **void to Generic_list*
- the info element of Generic_list happens to be the first element (offset 0), just list hdr of UtilList
- thus by chance list->info dereferences to ul.hdr
- there's never a real pointer to a Generic_list, only to Generic_list.info. Luckily the static list manipulation functions only access list.info
Possible patch
Possible patch attached. Still ugly as it depends on ul.hdr and list.info being on offset 0.
Another fix is to set "-fno-strict-aliasing" in CFLAGS, but this would break optimization.
genericlist.c is up for a larger rewrite I guess ;-)