I can't figure out what is wrong with my gmp stuff. I get this:
true
true
flx_run(72924) malloc: *** error for object 0x7fff706d1500: pointer being freed
was not allocated
*** set a breakpoint in malloc_error_break to debug
On OSX using dynamic linkage only: works on Linux, the static link on OSX also
works.
Gdb tells me the error is in _init_ routine, but a debug print right at the end
is executed fine.
the function just ends like this:
/*begin match*/
/*match case 1:|case 1*/
if(!((_i11378_v11378_x >= _i11379_v11379_y)==1) ) goto _11376;
_urv10598 = (_a3958t_15537)("true");
goto _11377;
/*match case 2:any*/
_11376:;
_urv10598 = (_a3958t_15537)("false");
_11377:;
*(&std::cout)<<_urv10598;
std::cout << std::endl;
}
[Without the debug print]
this code is used to print mpf values:
namespace flx { namespace gmp {
string flx_mpf_get_str(mpf_class const &a)
{
mp_exp_t x;
std::string s = a.get_str(x,10,0);
char b[100];
std::snprintf(b,100,"e%ld",(long)x);
return std::string(".")+s+b;
}
}}
The thing is .. there is no free() anywhere in sight.
There are deletes in flx_run *after* init returns.
The one thing that DOES happen right at the end of this function: the
destructors
of the C++ classes in gmpxx I'm using are run.
So by logic .. the bug HAS to be in gmpxx's destructors.
flx_run(72957) malloc: *** error for object 0x7fff706d1500: pointer being freed
was not allocated
*** set a breakpoint in malloc_error_break to debug
Program received signal SIGABRT, Aborted.
0x00007fff835cd886 in __kill ()
(gdb) bt
#0 0x00007fff835cd886 in __kill ()
#1 0x00007fff8366deae in abort ()
#2 0x00007fff83585a75 in free ()
#3 0x00000001000bca45 in flxusr::gmp__hyphen_0::_init_ ()
Previous frame inner to this frame (gdb could not unwind past this frame)
--
john skaller
[email protected]
------------------------------------------------------------------------------
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language