Package: libginac1.3c2
Version: 1.3.2-2
Severity: normal

Hello!

Recently I've noticed that most of my programs linked with GiNaC
library started to segfault. Here is an example:

$ cat bugme.cpp
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;

int main(int argc, char** argv)
{
        symbol d("d");
        symbol m("m");
        symbol K("K");
        symbol Q("Q"); // external momentum

        symbol C1("C1"); // k^2 + m^2
        symbol C2("C2"); // (k-q)^2 + m^2
        varidx mu(symbol("mu"), d);

        scalar_products sp;
        sp.add(K, K, C1 - pow(m, 2));
        sp.add(K, Q, numeric(1, 2)*(C1-C2+pow(Q,2)));
        sp.add(Q, Q, pow(Q, 2));

        // one-loop vacuum polarisation (transverse part)
        ex test = dirac_trace((-I*dirac_slash(K, d) + dirac_ONE()*m)
                        *dirac_gamma(mu)*(-I*dirac_slash(K-Q, d) + 
dirac_ONE()*m)
                        *dirac_gamma(mu.toggle_variance()));

        test = test.expand(expand_options::expand_indexed);
        test = test.simplify_indexed(sp);

        cout << test << endl;

        return 0;
}

$ g++ -O0 -g -o bugme bugme.cpp `ginac-config --libs`
$ ./bugme
8*m^2-2*Q^2*d+4*Q^2-4*C2-4*C1+2*d*C2+2*d*C1
Segmentation fault (core dumped)

$ gdb --silent ./bugme
Using host libthread_db library "/lib/libthread_db.so.1".
(gdb) run
Starting program: /home/pc7135/varg/tmp/bugme 
8*m^2-2*Q^2*d+4*Q^2-4*C2-4*C1+2*d*C2+2*d*C1

Program received signal SIGSEGV, Segmentation fault.
0x25ac7bce in __gnu_cxx::__pool<true>::_M_reclaim_block () from 
/usr/lib/libstdc++.so.6
(gdb) bt
#0  0x25ac7bce in __gnu_cxx::__pool<true>::_M_reclaim_block () from 
/usr/lib/libstdc++.so.6
#1  0x0804bb3f in 
__gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<GiNaC::spmapkey const, 
GiNaC::ex> >, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> 
>::deallocate (this=0x5ee84b5c, __p=0x805c998, __n=1)
    at mt_allocator.h:717
#2  0x0804bb5b in std::_Rb_tree<GiNaC::spmapkey, std::pair<GiNaC::spmapkey 
const, GiNaC::ex>, std::_Select1st<std::pair<GiNaC::spmapkey const, GiNaC::ex> 
>, std::less<GiNaC::spmapkey>, std::allocator<std::pair<GiNaC::spmapkey const, 
GiNaC::ex> > >::_M_put_node (this=0x5ee84b5c, __p=0x805c998) at stl_tree.h:360
#3  0x0804bbac in std::_Rb_tree<GiNaC::spmapkey, std::pair<GiNaC::spmapkey 
const, GiNaC::ex>, std::_Select1st<std::pair<GiNaC::spmapkey const, GiNaC::ex> 
>, std::less<GiNaC::spmapkey>, std::allocator<std::pair<GiNaC::spmapkey const, 
GiNaC::ex> > >::destroy_node (this=0x5ee84b5c, __p=0x805c998) at stl_tree.h:390
#4  0x0804bc20 in std::_Rb_tree<GiNaC::spmapkey, std::pair<GiNaC::spmapkey 
const, GiNaC::ex>, std::_Select1st<std::pair<GiNaC::spmapkey const, GiNaC::ex> 
>, std::less<GiNaC::spmapkey>, std::allocator<std::pair<GiNaC::spmapkey const, 
GiNaC::ex> > >::_M_erase (this=0x5ee84b5c, __x=0x805c998) at stl_tree.h:1097
#5  0x0804bbfd in std::_Rb_tree<GiNaC::spmapkey, std::pair<GiNaC::spmapkey 
const, GiNaC::ex>, std::_Select1st<std::pair<GiNaC::spmapkey const, GiNaC::ex> 
>, std::less<GiNaC::spmapkey>, std::allocator<std::pair<GiNaC::spmapkey const, 
GiNaC::ex> > >::_M_erase (this=0x5ee84b5c, __x=0x805cd58) at stl_tree.h:1095
#6  0x0804bc53 in ~_Rb_tree (this=0x5ee84b5c) at stl_tree.h:571
#7  0x0804bcea in ~map (this=0x5ee84b5c) at stl_map.h:92
#8  0x0804bd1a in ~scalar_products (this=0x5ee84b5c) at indexed.h:220
#9  0x0804ac1e in main (argc=1, argv=0x5ee84d54) at bugme.cpp:32

Note that recompiling the library (just apt-get source ginac; debuild -us -uc;
dpkg -i *.deb) seems to "fix" these segfaults.


-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.4.31-grsec-acl-pktcd-i686-smp
Locale: LANG=ru_RU.UTF-8, LC_CTYPE=ru_RU.UTF-8 (charmap=UTF-8)

Versions of packages libginac1.3c2 depends on:
ii  libc6                         2.3.5-7    GNU C Library: Shared libraries an
ii  libcln3c2                     1.1.9-6    Class Library for Numbers (C++)
ii  libgcc1                       1:4.0.2-3  GCC support library
ii  libgmp3c2                     4.1.4-11   Multiprecision arithmetic library
ii  libstdc++6                    4.0.2-3    The GNU Standard C++ Library v3

libginac1.3c2 recommends no packages.

-- no debconf information
ii

-- 
All science is either physics or stamp collecting.

Attachment: signature.asc
Description: Digital signature

Reply via email to