MatteoLacki / IsoSpec

Libraries for fine isotopic structure calculator.
Other
35 stars 10 forks source link

Bugreport #11

Closed hroest closed 5 years ago

hroest commented 5 years ago

I found a segfault under specific circumstances which can be reproduced as follows:

$ cd tests/C++/
$ make segfault  && ./segfault-clang 

interestingly, this occurs when calling new IsoLayeredGenerator with a simple molecule such as H2O1 after a previous call into the library, and only if -fsanitize=address is not passed as an argument. You can test this with

$ make segfault  && ./segfault-ok-clang 
$ make segfault  && ./segfault-ok2-clang 

which both work fine.

hroest commented 5 years ago

PS: here is the backtrace using a debug-build

maxConfsLPSum[idx-1]: -0.000231433
partialLProbs[idx]: -6.18924

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7999d9a in LayeredMarginal::get_lProb (this=0x6199d0, idx=32767) at ./marginalTrek++.h:203
203     inline double get_lProb(int idx) const { return guarded_lProbs[idx]; }; // access to idx == -1 is valid and gives a guardian of +inf
(gdb) bt
#0  0x00007ffff7999d9a in LayeredMarginal::get_lProb (this=0x6199d0, idx=32767) at ./marginalTrek++.h:203
#1  0x00007ffff79947ae in IsoLayeredGenerator::advanceToNextConfiguration_internal (this=0x617010) at ./isoSpec++.cpp:729
#2  0x000000000040299d in IsoLayeredGenerator::advanceToNextConfiguration (this=0x617010) at ../../IsoSpec++/isoSpec++.h:251
#3  0x0000000000402773 in Tabulator<IsoLayeredGenerator>::Tabulator (this=0x619780, generator=0x617010, get_masses=true, 
    get_probs=true, get_lprobs=true, get_confs=true) at ../../IsoSpec++/tabulator.cpp:50
#4  0x0000000000401ede in main () at segfault.cpp:40
michalsta commented 5 years ago

I'm going to go ahead and close this - this part of the code is getting ripped out for 1.9.0, and completely rewritten for 2.0...