Dear all,<br>I have a problem with Ginac.<br>I&#39;m sorry if my question seems stupid, but I cannot solve the issue.<br><br>So, I define a new class:<br><br>class rinterval<br>{<br>        public:<br>        numeric min;<br>

        numeric max;<br>        numeric error;<br>    <br>        //Constructor<br>        rinterval();<br>        rinterval(const numeric &amp;, const numeric &amp;, const numeric &amp;);<br>        //Destructor<br>        ~rinterval();<br>

        //Friend<br>        friend const rinterval dynamic(const rinterval &amp;);<br>        friend std::ostream &amp;operator&lt;&lt; (std::ostream &amp;os, const rinterval &amp;inter)<br>        {<br>        return os &lt;&lt; &quot;[&quot; &lt;&lt; inter.min &lt;&lt; &quot;,&quot; &lt;&lt; inter.max &lt;&lt;&quot;], error = &quot; &lt;&lt; inter.error &lt;&lt; endl;<br>

        };<br>        rinterval&amp; operator=(const rinterval &amp;rhs);        <br>};<br><br>The involved functions are these<br><br>rinterval::rinterval(const numeric &amp;input1, const numeric &amp;input2, const numeric &amp;miserr)<br>

{<br>    if (input1&gt;input2)<br>        {<br>            min=input2;<br>            max=input1;<br>        }<br>    else<br>        {<br>            min=input1;<br>            max=input2;<br>        }<br>    error=miserr;<br>

}<br><br>const rinterval dynamic(const rinterval &amp;domain)<br>{<br>    numeric a=&quot;1.47777777777777777777777777779999&quot;;<br>    rinterval temp(a*domain.min,a*domain.max,domain.error);<br>    cout &lt;&lt; temp;<br>

    return temp;<br>}<br><br>rinterval&amp; rinterval::operator=(const rinterval &amp;rhs)<br>{<br>        if (this == &amp;rhs)  return *this;    // Same object?      <br>        else<br>        {<br>        try<br>        {<br>

        this-&gt;min=rhs.min;<br>        this-&gt;max=rhs.max;<br>        error=rhs.error;<br>        }<br>        catch(std::exception &amp; exc)<br>        {    <br>            std:cerr &lt;&lt; &quot;Exception&quot; &lt;&lt; exc.what() &lt;&lt; endl;<br>

        }<br>        return *this;<br>        }<br>}<br><br>Now, if inside the main I do<br><br>int main (void)<br>{<br>numeric a(1,10);<br>numeric b(2,10);<br>rinterval inter(a,b,(numeric)0.00001);<br>inter=dynamic(inter);    <br>

cout &lt;&lt; inter &lt;&lt; endl;<br>}<br><br>I get the following error:<br>*** glibc detected *** ./invmeasure.exe: invalid fastbin entry (free): 0x00000000008ec340 ***<br>======= Backtrace: =========<br>/lib/libc.so.6(+0x774b6)[0x7f2c9b11a4b6]<br>

/lib/libc.so.6(cfree+0x73)[0x7f2c9b120c83]<br>/usr/lib/libcln.so.6(+0x6fa0d)[0x7f2c9ad91a0d]<br>/usr/lib/libcln.so.6(_ZN3cln11print_floatERSoRKNS_20cl_print_float_flagsERKNS_4cl_FE+0x29)[0x7f2c9ad92d39]<br>/usr/lib/libginac-1.5.so.0(+0x1ddb5b)[0x7f2c9bfbfb5b]<br>

/usr/lib/libginac-1.5.so.0(_ZNK5GiNaC7numeric13print_numericERKNS_13print_contextEPKcS5_S5_S5_j+0x97)[0x7f2c9bfc0857]<br>/usr/lib/libginac-1.5.so.0(_ZNK5GiNaC7numeric8do_printERKNS_13print_contextEj+0x28)[0x7f2c9bfc0e48]<br>

/usr/lib/libginac-1.5.so.0(_ZNK5GiNaC5basic14print_dispatchERKNS_10class_infoINS_24registered_class_optionsEEERKNS_13print_contextEj+0x18b)[0x7f2c9be6c62b]<br>/usr/lib/libginac-1.5.so.0(_ZN5GiNaClsERSoRKNS_2exE+0x9e)[0x7f2c9bfe5c2e]<br>

./invmeasure.exe[0x404261]<br>./invmeasure.exe[0x403808]<br>/lib/libc.so.6(__libc_start_main+0xfe)[0x7f2c9b0c1d8e]<br>./invmeasure.exe[0x403439]<br>======= Memory map: ========<br>00400000-00407000 r-xp 00000000 08:07 66333                              /home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe<br>

00607000-00608000 r--p 00007000 08:07 66333                              /home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe<br>00608000-00609000 rw-p 00008000 08:07 66333                              /home/isaia/Dropbox/HTGFL/GN-Comput_inv_1D/codice/invmeasure.exe<br>

008c7000-00909000 rw-p 00000000 00:00 0                                  [heap]<br>7f2c94000000-7f2c94021000 rw-p 00000000 00:00 0 <br>7f2c94021000-7f2c98000000 ---p 00000000 00:00 0 <br>7f2c9a8be000-7f2c9a91d000 r-xp 00000000 08:07 1523786                    /usr/lib/libgmp.so.3.5.2<br>

7f2c9a91d000-7f2c9ab1c000 ---p 0005f000 08:07 1523786                    /usr/lib/libgmp.so.3.5.2<br>7f2c9ab1c000-7f2c9ab1d000 r--p 0005e000 08:07 1523786                    /usr/lib/libgmp.so.3.5.2<br>7f2c9ab1d000-7f2c9ab1e000 rw-p 0005f000 08:07 1523786                    /usr/lib/libgmp.so.3.5.2<br>

7f2c9ab1e000-7f2c9ab20000 r-xp 00000000 08:07 262984                     /lib/<a href="http://libdl-2.12.1.so">libdl-2.12.1.so</a><br>7f2c9ab20000-7f2c9ad20000 ---p 00002000 08:07 262984                     /lib/<a href="http://libdl-2.12.1.so">libdl-2.12.1.so</a><br>

7f2c9ad20000-7f2c9ad21000 r--p 00002000 08:07 262984                     /lib/<a href="http://libdl-2.12.1.so">libdl-2.12.1.so</a><br>7f2c9ad21000-7f2c9ad22000 rw-p 00003000 08:07 262984                     /lib/<a href="http://libdl-2.12.1.so">libdl-2.12.1.so</a><br>

7f2c9ad22000-7f2c9ae98000 r-xp 00000000 08:07 1549774                    /usr/lib/libcln.so.6.0.1<br>7f2c9ae98000-7f2c9b097000 ---p 00176000 08:07 1549774                    /usr/lib/libcln.so.6.0.1<br>7f2c9b097000-7f2c9b09b000 r--p 00175000 08:07 1549774                    /usr/lib/libcln.so.6.0.1<br>

7f2c9b09b000-7f2c9b0a1000 rw-p 00179000 08:07 1549774                    /usr/lib/libcln.so.6.0.1<br>7f2c9b0a1000-7f2c9b0a3000 rw-p 00000000 00:00 0 <br>7f2c9b0a3000-7f2c9b21d000 r-xp 00000000 08:07 262821                     /lib/<a href="http://libc-2.12.1.so">libc-2.12.1.so</a><br>

7f2c9b21d000-7f2c9b41c000 ---p 0017a000 08:07 262821                     /lib/<a href="http://libc-2.12.1.so">libc-2.12.1.so</a><br>7f2c9b41c000-7f2c9b420000 r--p 00179000 08:07 262821                     /lib/<a href="http://libc-2.12.1.so">libc-2.12.1.so</a><br>

7f2c9b420000-7f2c9b421000 rw-p 0017d000 08:07 262821                     /lib/<a href="http://libc-2.12.1.so">libc-2.12.1.so</a><br>7f2c9b421000-7f2c9b426000 rw-p 00000000 00:00 0 <br>7f2c9b426000-7f2c9b43b000 r-xp 00000000 08:07 262222                     /lib/libgcc_s.so.1<br>

7f2c9b43b000-7f2c9b63a000 ---p 00015000 08:07 262222                     /lib/libgcc_s.so.1<br>7f2c9b63a000-7f2c9b63b000 r--p 00014000 08:07 262222                     /lib/libgcc_s.so.1<br>7f2c9b63b000-7f2c9b63c000 rw-p 00015000 08:07 262222                     /lib/libgcc_s.so.1<br>

7f2c9b63c000-7f2c9b6be000 r-xp 00000000 08:07 262828                     /lib/<a href="http://libm-2.12.1.so">libm-2.12.1.so</a><br>7f2c9b6be000-7f2c9b8bd000 ---p 00082000 08:07 262828                     /lib/<a href="http://libm-2.12.1.so">libm-2.12.1.so</a><br>

7f2c9b8bd000-7f2c9b8be000 r--p 00081000 08:07 262828                     /lib/<a href="http://libm-2.12.1.so">libm-2.12.1.so</a><br>7f2c9b8be000-7f2c9b8bf000 rw-p 00082000 08:07 262828                     /lib/<a href="http://libm-2.12.1.so">libm-2.12.1.so</a><br>

7f2c9b8bf000-7f2c9b9a7000 r-xp 00000000 08:07 1523946                    /usr/lib/libstdc++.so.6.0.14<br>7f2c9b9a7000-7f2c9bba6000 ---p 000e8000 08:07 1523946                    /usr/lib/libstdc++.so.6.0.14<br>7f2c9bba6000-7f2c9bbae000 r--p 000e7000 08:07 1523946                    /usr/lib/libstdc++.so.6.0.14<br>

7f2c9bbae000-7f2c9bbb0000 rw-p 000ef000 08:07 1523946                    /usr/lib/libstdc++.so.6.0.14<br>7f2c9bbb0000-7f2c9bbc5000 rw-p 00000000 00:00 0 <br>7f2c9bbc5000-7f2c9bbdd000 r-xp 00000000 08:07 262823                     /lib/<a href="http://libpthread-2.12.1.so">libpthread-2.12.1.so</a><br>

7f2c9bbdd000-7f2c9bddc000 ---p 00018000 08:07 262823                     /lib/<a href="http://libpthread-2.12.1.so">libpthread-2.12.1.so</a><br>7f2c9bddc000-7f2c9bddd000 r--p 00017000 08:07 262823                     /lib/<a href="http://libpthread-2.12.1.so">libpthread-2.12.1.so</a><br>

7f2c9bddd000-7f2c9bdde000 rw-p 00018000 08:07 262823                     /lib/<a href="http://libpthread-2.12.1.so">libpthread-2.12.1.so</a><br>7f2c9bdde000-7f2c9bde2000 rw-p 00000000 00:00 0 <br>7f2c9bde2000-7f2c9c0c1000 r-xp 00000000 08:07 1524595                    /usr/lib/libginac-1.5.so.0.2.0<br>

7f2c9c0c1000-7f2c9c2c0000 ---p 002df000 08:07 1524595                    /usr/lib/libginac-1.5.so.0.2.0<br>7f2c9c2c0000-7f2c9c2cc000 r--p 002de000 08:07 1524595                    /usr/lib/libginac-1.5.so.0.2.0<br>7f2c9c2cc000-7f2c9c2cd000 rw-p 002ea000 08:07 1524595                    /usr/lib/libginac-1.5.so.0.2.0<br>

7f2c9c2cd000-7f2c9c2cf000 rw-p 00000000 00:00 0 <br>7f2c9c2cf000-7f2c9c2ef000 r-xp 00000000 08:07 262975                     /lib/<a href="http://ld-2.12.1.so">ld-2.12.1.so</a><br>7f2c9c4c3000-7f2c9c4ca000 rw-p 00000000 00:00 0 <br>

7f2c9c4ec000-7f2c9c4ef000 rw-p 00000000 00:00 0 <br>7f2c9c4ef000-7f2c9c4f0000 r--p 00020000 08:07 262975                     /lib/<a href="http://ld-2.12.1.so">ld-2.12.1.so</a><br>7f2c9c4f0000-7f2c9c4f1000 rw-p 00021000 08:07 262975                     /lib/<a href="http://ld-2.12.1.so">ld-2.12.1.so</a><br>

7f2c9c4f1000-7f2c9c4f2000 rw-p 00000000 00:00 0 <br>7fff794fd000-7fff7951e000 rw-p 00000000 00:00 0                          [stack]<br>7fff795c7000-7fff795c8000 r-xp 00000000 00:00 0                          [vdso]<br>ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]<br>

<br>I don&#39;t understand why, isn&#39;t the destruction of the old instances of min and max done by the assignment operator for the type numeric?<br><br>Thank you in advance<br>Isaia<br><br>