> If I fix the punning warnings, the problem goes away.

Interesting!  I spent some time in my last job (before retiring)
analyzing and trying to fix type-punned-pointer warnings in a very large
old package.  My take-away was that some well-intentioned people
purposely broke old C code in the name of efficiency (smarter and
smarter compilers) by allowing higher levels of optimization to make
sometimes bad assumptions about apparently non-overlapping memory
addresses that in fact do overlap.  The decision might go back to 1999!

The best they could seem to offer was obscure warnings (unless you hid
them) leading to some real head-scratching about what exactly was the
problem and how to fix it.  Despite deep analysis (now mostly forgotten)
we never did 100% understand precisely how to "do the right thing" in
all cases...  For example, unions were supposed to be a way to tell the
compiler, "I really mean to overlap these bytes" but it didn't always
make the warnings go away.  Conversely it seemed like doing a cast
should be ironclad evidence of intention, yet it was deemed
insufficient.  We converted a lot of old code to use unions hoping they
would work properly and at no significant added CPU cost.

Funny thing is, we NEVER saw a single code misbehavior directly linked
to type-punned pointers.

Cheers,
Alan Silverstein

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Judy-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/judy-devel

Reply via email to