Commit 194ac52a by Jakub Jelinek Committed by Jakub Jelinek

re PR tree-optimization/36008 (Function produces wrong results when inlined.)

	PR tree-optimization/36008
	* fold-const.c (try_move_mult_to_index): If s == NULL, divide
	the original op1, rather than delta by step.

	* gcc.c-torture/execute/20080424-1.c: New test.

From-SVN: r134634
parent 9f9f72aa
2008-04-24 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/36008
* fold-const.c (try_move_mult_to_index): If s == NULL, divide
the original op1, rather than delta by step.
2008-04-22 Antoniu Pop <antoniu.pop@gmail.com>
Sebastian Pop <sebastian.pop@amd.com>
......
......@@ -6919,7 +6919,7 @@ try_move_mult_to_index (tree addr, tree op1)
else
{
/* Try if delta is a multiple of step. */
tree tmp = div_if_zero_remainder (EXACT_DIV_EXPR, delta, step);
tree tmp = div_if_zero_remainder (EXACT_DIV_EXPR, op1, step);
if (! tmp)
continue;
delta = tmp;
......
2008-04-24 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/36008
* gcc.c-torture/execute/20080424-1.c: New test.
2008-04-24 Ira Rosen <irar@il.ibm.com>
Richard Guenther <rguenther@suse.de>
/* PR tree-optimization/36008 */
extern void abort (void);
int g[48][3][3];
void __attribute__ ((noinline))
bar (int x[3][3], int y[3][3])
{
static int i;
if (x != g[i + 8] || y != g[i++])
abort ();
}
static inline void __attribute__ ((always_inline))
foo (int x[][3][3])
{
int i;
for (i = 0; i < 8; i++)
{
int k = i + 8;
bar (x[k], x[k - 8]);
}
}
int
main ()
{
foo (g);
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment