ellzey/libevhtp — Issue #9: Use -fno-strict-aliasing with GCC, or fix aliasing issues
Author: nmathewson
Created: 2011-12-15 01:06:01+00:00
State: open

GCC's strict aliasing optimizations are an accident waiting to happen. You do some perfectly nice C type-punning, then WHAM! The compiler decides that it can eliminate real assignments as dead-code, because you accessed them through a type-punned pointer.

Don't let this happen to you! Supply -fno-strict-aliasing when you build with GCC.

(There are already aliasing violations in libevhtp: gcc notices some of them in the _strXcmp functions in htparse.c, but there may be more that gcc does not notice.)