------- Comment #16 from jakub at gcc dot gnu dot org 2007-10-27 09:42 ------- Created an attachment (id=14413) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14413&action=view) perl-5.8.7-aliasing.patch
Sure, here is a minimal patch against perl 5.8.7 which cures this (and for whatever reason happens to apply to SPEC2006 as well). The S_{new,del,more}_xiv changes IMHO aren't controversial at all, perl assumes that IV aka long can hold a pointer. For S_{new,del,more}_xnv where NV is double there is an option to use memcpy as in the patch (for S_new_xnv and S_del_xnv is GCC 4.3 able to compile exactly the same code as before when those functions are noinline, S_more_xnv is 2 or 3 insns larger, but nothing serious) which IMHO is standard conforming, or could e.g. use union { NV nv; NV *xnv; } u; and stuff values through it (but, as double is bigger than pointer on 32-bit arches wouldn't we risk issues with signalling NaNs?), or of course can do much bigger changes and change the data structures that contain e.g. xnv_nv fields to an anonymous union. >From quick skimming other S_{new,del,more}_x* routines the other routines don't violate strict aliasing. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33383