On Aug 2, 2008, at 5:26 PM, Alexey Neyman wrote:
Small correction: the option to GCC which fixes this problem
is "-fno-tree-vrp",
...which, from the GCC 4.3 documentation, turns off an optimization
pass:
-ftree-vrp
Perform Value Range Propagation on trees. This is similar to the
constant propagation pass, but instead of values, ranges of values are
propagated. This allows the optimizers to remove unnecessary range
checks like array bound checks and null pointer checks. This is
enabled by default at -O2 and higher. Null pointer check elimination
is only done if -fdelete-null-pointer-checks is enabled.
so, all other things, I'd prefer not to turn that one off.
The documentation's discussion of -fstring-overflow mentions -fwrapv:
-fwrapv
This option instructs the compiler to assume that signed arithmetic
overflow of addition, subtraction and multiplication wraps around
using twos-complement representation. This flag enables some
optimizations and disables others. This option is enabled by default
for the Java front-end, as required by the Java language specification.
We only run on two's-complement platforms, as far as I know (no Univac
mainframes run Wireshark, as far as I know), so, unless signed
arithmetic overflow causes a trap, addition and subtraction presumably
wrap around. Does turning that option on fix this problem?