http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46758
Alexander Monakov <amonakov at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |NEW
AssignedTo|amonakov at gcc dot gnu.org |unassigned at gcc dot
| |gnu.org
--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> 2010-12-13
17:24:59 UTC ---
Ouch. The "obvious" fix:
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 5036fba..8fda288 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -626,16 +626,9 @@ scan_tree_for_params_int (tree cst,
ppl_Linear_Expression_t expr, mpz_t k)
{
mpz_t val;
ppl_Coefficient_t coef;
- int v = int_cst_value (cst);
mpz_init (val);
- mpz_set_si (val, 0);
-
- /* Necessary to not get "-1 = 2^n - 1". */
- if (v < 0)
- mpz_sub_ui (val, val, -v);
- else
- mpz_add_ui (val, val, v);
+ tree_int_to_gmp (cst, val);
mpz_mul (val, val, k);
ppl_new_Coefficient (&coef);
Makes Graphite fail most tests because this scanning machinery curiously
depends on signed/unsigned conversions/overflow. For example, when an IV upper
bound N-1 is expressed as (unsigned)(N + 0xFFFFFFFFU), the patch makes Graphite
actually generate N + 0xFFFFFFFFU as upper bound in the corresponding PPL
expression:
(gdb) p nb_iters
$2 = (tree) 0x7ffff7ff9ee0
(gdb) pt
<plus_expr 0x7ffff7ff9ee0
type <integer_type 0x7ffff7ed0540 unsigned int public unsigned SI
size <integer_cst 0x7ffff7ebd6e0 constant 32>
unit size <integer_cst 0x7ffff7ebd3e8 constant 4>
align 32 symtab 0 alias set -1 canonical type 0x7ffff7ed0540 precision
32 min <integer_cst 0x7ffff7ebd708 0> max <integer_cst 0x7ffff7ebd6b8
4294967295>
pointer_to_this <pointer_type 0x7ffff7ee5150>>
arg 0 <nop_expr 0x7ffff5a72420 type <integer_type 0x7ffff7ed0540 unsigned
int>
arg 0 <ssa_name 0x7ffff5a73370 type <integer_type 0x7ffff7ed0498 int>
visited var <parm_decl 0x7ffff7ec6880 y>def_stmt GIMPLE_NOP
version 6>>
arg 1 <integer_cst 0x7ffff7ebd6b8 type <integer_type 0x7ffff7ed0540
unsigned int> constant 4294967295>>
(gdb) call debug_ppl_linear_expr (ub_expr)
1 5
0 0 1 0 4294967295
I don't know how to fix this; thus, unassigning. Sorry.