[GiNaC-devel] Crash during startup

Richard B. Kreckel kreckel at thep.physik.uni-mainz.de
Wed Jan 5 22:16:03 CET 2005


Happy new year!

On Sun, 26 Dec 2004, I wrote:
> Checking out a fresh GiNaC-1.3 tree and configuring --disable-shared
> (after having called autogen.sh) leaves one with three crashing binaries
> in the test suite.  It seems to be independend of compiler flags.  A
> shared library works, as does ginsh.  (@Jens and Cebix: I reproduced this
> on wino.)
>
> A stack backtrace indicates that GiNaC::basic::gethash() is being invoked
> on NULL:
>
> (gdb) run
> Starting program:
> /autofs/medium/home/kreckel/projects/GiNaC-1.4/check/checks
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x08079827 in GiNaC::basic::gethash (this=0x0) at basic.h:254
> 254                     if (flags & status_flags::hash_calculated) {
> (gdb) bt
> #0  0x08079827 in GiNaC::basic::gethash (this=0x0) at basic.h:254
> #1  0x08078fcf in GiNaC::basic::is_equal (this=0x81feb70, other=@0x0) at basic.cpp:888
> #2  0x08056bb2 in GiNaC::ex::is_equal (this=0xffffda30, other=@0x81fa5a4) at ex.h:399
> #3  0x0805b2eb in GiNaC::ex::is_zero (this=0xffffda30) at ex.h:208
> #4  0x08163bb8 in GiNaC::power::eval (this=0xffffdac0, level=1) at power.cpp:359
> #5  0x0807e2d5 in GiNaC::ex::construct_from_basic (other=@0xffffdac0) at ex.cpp:287
> #6  0x08050136 in ex (this=0x81fa8e4, other=@0xffffdac0) at ex.h:304
> #7  0x08165c69 in GiNaC::power::evalf (this=0xffffdb60, level=0) at power.cpp:525
> #8  0x081a279e in __static_initialization_and_destruction_0 (__initialize_p=1, __priority=65535)
>     at integral.cpp:206
> #9  0x081a28a6 in global constructors keyed to _ZN5GiNaC8integral8reg_infoE () at container.h:130
> #10 0x081a3825 in __do_global_ctors_aux ()
> #11 0x0804dc19 in _init ()
> #12 0x081a375b in __libc_csu_init ()
> #13 0x557a57a2 in __libc_start_main () from /lib/tls/libc.so.6
> #14 0xffffdc64 in ?? ()
>
> Are we still having initialization order problems?

Chris, I'm afraid you introduced a new static initialization order problem
when you sent us your integral.cpp file.  You cannot initialize static ex
integral::relative_integration_error like you do in integral.cpp:206.
That does not take care of the initialization order.  The ctor of class
GiNaC::library_init is there to solve such problems.  Please add a numeric
and ex object representing the number 1e-8 in utils.h and utils.cpp and
use that one instead.

Would you please be so kind and sent a patch to this list for my review?

Best wishes
  -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>




More information about the GiNaC-devel mailing list