Writing a wrapper around rational?

Linas Vepstas linas at austin.ibm.com
Tue Dec 12 20:09:57 CET 2006


On Mon, Dec 11, 2006 at 07:10:30PM -0800, Susan Margulies wrote:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000000000428c67 in __gmpq_set ()
> (gdb)

The only time I get these is when I forgot to mpq_init()
the variable I'm setting, or have previously mpq_clear()'ed it.

> Here is the precise line that causes the crash, in reduce rows
> 
> if (rr_iter == rr_map.end()) {
>             rr_q = (*rr_iter).second;

Perhaps rr_q hasn't been inited. You can debug by printing out
the addresses of all the things you call mpq_init on, and then see if 
rr_q is in that list of addresses.

--linas


More information about the gmp-discuss mailing list