[GiNaC-list] [(Possible) Bug Report] g++-4.8 (slightly) breaks GiNaC::symbol

Song Gao song at gao.io
Mon Mar 25 03:34:39 CET 2013


I had a weird problem using GiNaC with g++-4.8. It seems that
GiNac::symbol will be deleted twice if it's not dynamically declared.
In other words, some resources in it is free'd before the automatic
destructor is called when the scope finishes.

The minimum code to re-produce the issue is:

#include <ginac/ginac.h>

int main() {
    GiNaC::symbol x("x");
    return 0;

$ g++-4.8 -g -o main main0.cc -lginac -lcln && ./main
main(69018) malloc: *** error for object 0x7fff73275570: pointer being
freed was not allocated

It seems this issue only exists in g++-4.8. g++-4.7 is fine.

I briefly looked at symbol.h but did not manage to locate the problem.
I was hoping someone here more familiar with the code base could fix
it or provide some direction for me. Thanks.

Song Gao

More information about the GiNaC-list mailing list