This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Sign extend before converting constants to GMP values.
On Thu, 30 Jun 2011, Sebastian Pop wrote:
> On Thu, Jun 30, 2011 at 09:57, Sebastian Pop <sebpop@gmail.com> wrote:
> >> Canonically extended according to TYPE_UNSIGNED I mean. ?So what you
> >> do is always create signed mpzs - that should simply work without
> >> doing anything to the double-int. ?Thus, why not do
> >>
> >> static inline void
> >> tree_int_to_gmp (tree t, mpz_t res)
> >> {
> >> ?double_int di = tree_to_double_int (t);
> >> ?mpz_set_double_int (res, di, false);
> >> }
> >>
> >> ?
>
> I tried that and just passing false does not fix PR47653.
> You still have the problem of the unsigned decrementing induction variable
> that I described.
Well, you have to properly translate unsigned (modulo arithmetic)
IVs to signed mpz arithmetic. Which isn't possible in all cases
(where modulo arithmetic matters). I don't think that
tree_int_to_gmp is the place where this translation should happen.
Esp. because it then no longer is tree_int_to_gmp.
Richard.