[PATCH] PR tree-optimization/43833

Jie Zhang jie@codesourcery.com
Wed Apr 21 15:14:00 GMT 2010


When debugging this PR, I found VRP dump contained this:


   Found new range for j_99: [35, 35]


   Visiting statement:
   D.2725_100 = j_99 & 7;

   Found new range for D.2725_100: [0, 35]


But its range should be [3, 3]. Thus when we came to


   Visiting statement:
   if (D.2725_100 > 3)


   Visiting conditional with predicate: if (D.2725_100 > 3)

   With known ranges
         D.2725_100: [0, 35]

   Predicate evaluates to: DON'T KNOW


It should actually be evaluated to false, which would prevent GCC 
issuing the "array subscript is above array bounds" warning in the 
resulted dead code.

This patch fixes the range calculation for this case.

Bootstrapped and regtested on x86_64-pc-linux-gnu. Is it OK?


-- 
Jie Zhang
CodeSourcery
(650) 331-3385 x735
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-fix-pr43833.diff
Type: text/x-patch
Size: 2285 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100421/d52bac11/attachment.bin>


More information about the Gcc-patches mailing list