On 07/07/11 13:37, Richard Guenther wrote:
I'll cook up a quick patch for VRP.
Like the attached. I'll finish and properly test it.
Your patch appears to do the wrong thing for this test case:
int
foo (int a, short b, short c)
{
int bc = b * c;
return a + (short)bc;
}
With your patch, the input to the widening-mult pass now looks like this:
foo (int a, short int b, short int c)
{
int bc;
int D.2016;
int D.2015;
int D.2014;
<bb 2>:
D.2014_2 = (int) b_1(D);
D.2015_4 = (int) c_3(D);
bc_5 = D.2014_2 * D.2015_4;
D.2016_9 = bc_5 + a_8(D);
return D.2016_9;
}
It looks like when the user tries to deliberately break the maths your
patch seems to unbreak it.
Andrew