[GiNaC-devel] Crash during startup

Chris Dams C.Dams at science.ru.nl
Thu Jan 6 12:57:04 CET 2005


Dear Richy,

Happy new year!

On Wed, 5 Jan 2005, Richard B. Kreckel wrote:

> 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.

Hmmm... Wait a minute... If I understand correctly, this means that
initialization of integral::relative_integration_error occurs before the
initialization of the library_init of the same file integral.o as well as
before the initialization of all other library_init objects in all GiNaCs
other object files. Isn't this a bit strange??? I mean, can't the runtime
environment (or whatever it is called) just initialize static objects in
the same order as they are defined in the preprocessed C++-code??? If the
order of static initialization were the same as the order of definition
were the same, there would not be a problem, right?

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

I would suggest the change in the attached patch, since the functions that
are used in this patch do not seem to involve any static variables.
Unfortunately I do not know how to test this, because at my place no crash
occured in the first place. Do you think this is sufficient to avoid a
crash in all cases?

Best wishes,
Chris
-------------- next part --------------
Index: ginac/integral.cpp
===================================================================
RCS file: /home/cvs/GiNaC/ginac/integral.cpp,v
retrieving revision 1.2
diff -c -r1.2 integral.cpp
*** ginac/integral.cpp	14 Oct 2004 15:36:45 -0000	1.2
--- ginac/integral.cpp	6 Jan 2005 11:49:42 -0000
***************
*** 203,209 ****
  }
  
  int integral::max_integration_level = 15;
! ex integral::relative_integration_error = power(10,-8).evalf();
  
  ex subsvalue(const ex & var, const ex & value, const ex & fun)
  {
--- 203,211 ----
  }
  
  int integral::max_integration_level = 15;
! ex integral::relative_integration_error
! 	= (new numeric(1e-8))
! 		->setflag(status_flags::dynallocated | status_flags::evaluated);
  
  ex subsvalue(const ex & var, const ex & value, const ex & fun)
  {


More information about the GiNaC-devel mailing list