Problem with __gmp_expr

Niels Möller nisse at lysator.liu.se
Fri Jan 17 13:50:57 UTC 2014


Marc Glisse <marc.glisse at inria.fr> writes:

> In gmp, -m*a is a neg
> expr that stores a ref to a mult expr that stores references to m and
> a. Since you managed to postpone the evaluation of the expression, the
> mult expr went out of scope (older versions of gcc don't crash because
> they are not good at reusing space from dead objects).

I don't understand these things, but it sounds very brittle. If some
usages are simply not supported by gmpxx, is there some way to either
get a compile time error when a referenced expression goes out of scope,
or at least some more *controlled* crash or assertion failure, without
trashing random memory locations?

> Other libraries would have a big neg expr that embeds a copy of the
> mult expr,

Now you're talking about copies of the expr objects used in the template
machinery, not copies of the underlying numbers?

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.


More information about the gmp-bugs mailing list