[vta,trunk] don't call floor_log2(0) in tree-vrp
Alexandre Oliva
aoliva@redhat.com
Sun Mar 1 05:36:00 GMT 2009
Shortly after I started working on the latest merge to the VTA branch,
started back in December, I ran into a situation in which we got
different compiler output between stage1 and stage2, because the inline
definition was used when optimizing, and the shift left by -1 ==
floor_log2(0) produced different results.
This patch avoids the divergence, ensuring that (i) we negate signed
numbers with the right width, and that (ii) we don't bother calling
floor_log2 and then invoking unspecified behavior.
Unfortunately, I don't remember any more what testcase it was that
triggered this difference. It appears to me that the only possibility
this could hit is if both operands of a BIT_IOR_EXPR have ranges
containing only the zero value.
Anyhow, here's the patch. I'm installing it in the VTA branch. Ok for
trunk?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-dont-shift-by-log-of-zero.patch
Type: text/x-patch
Size: 836 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20090301/36af1a7f/attachment.bin>
-------------- next part --------------
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist Red Hat Brazil Compiler Engineer
More information about the Gcc-patches
mailing list