I don't have time today to track this down today, but here is what I
found running it under valgrind. Running the model and data normally
produces the crash you're describing. However, when run under
valgrind it produces:
[mbrubake@dynamics stan]$ valgrind --tool=memcheck ./negbin-test
--data=negbin.data==20177== Memcheck, a memory error detector
==20177== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==20177== Using Valgrind-3.6.0 and LibVEX; rerun with -h for copyright info
==20177== Command: ./negbin-test --data=negbin.data
==20177==
==20177== Conditional jump or move depends on uninitialised value(s)
==20177== at 0x807B361: stan::io::dump_reader::scan_name() (dump.hpp:460)
==20177== by 0x8079D74: stan::io::dump_reader::next() (dump.hpp:769)
==20177== by 0x807974D: stan::io::dump::dump(std::istream&) (dump.hpp:833)
==20177== by 0x8051DB6: int
stan::gm::nuts_command<anon_model_namespace::anon_model>(int, char
const**) (command.hpp:229)
==20177== by 0x805105C: main (negbin-test.cpp:217)
==20177==
==20177== Conditional jump or move depends on uninitialised value(s)
==20177== at 0x807B3D1: stan::io::dump_reader::scan_name() (dump.hpp:460)
==20177== by 0x8079D74: stan::io::dump_reader::next() (dump.hpp:769)
==20177== by 0x807974D: stan::io::dump::dump(std::istream&) (dump.hpp:833)
==20177== by 0x8051DB6: int
stan::gm::nuts_command<anon_model_namespace::anon_model>(int, char
const**) (command.hpp:229)
==20177== by 0x805105C: main (negbin-test.cpp:217)
==20177==
==20177== Use of uninitialised value of size 4
==20177== at 0x2D529F: isalpha (in /lib/
libc-2.12.so)
==20177== by 0x807B415: stan::io::dump_reader::scan_name() (dump.hpp:488)
==20177== by 0x8079D74: stan::io::dump_reader::next() (dump.hpp:769)
==20177== by 0x807974D: stan::io::dump::dump(std::istream&) (dump.hpp:833)
==20177== by 0x8051DB6: int
stan::gm::nuts_command<anon_model_namespace::anon_model>(int, char
const**) (command.hpp:229)
==20177== by 0x805105C: main (negbin-test.cpp:217)
==20177==
Exception: variable N not found.
Diagnostic information:
Dynamic exception type: std::runtime_error
std::exception::what: variable N not found.
==20177==
==20177== HEAP SUMMARY:
==20177== in use at exit: 0 bytes in 0 blocks
==20177== total heap usage: 29 allocs, 29 frees, 67,138 bytes allocated
==20177==
==20177== All heap blocks were freed -- no leaks are possible
==20177==
==20177== For counts of detected and suppressed errors, rerun with: -v
==20177== Use --track-origins=yes to see where uninitialised values come from
==20177== ERROR SUMMARY: 3 errors from 3 contexts (suppressed: 15 from 8)
Notice that it crashes for a different reason. It seems like there is
an uninitialized bit of memory being accessed when loading the
parameters for some reason. When it's accessed under valgrind, it is
preinitialized to zero and causes an exception to eventually be
thrown. Under normal conditions it's non-zero and results in a crash
later on for some reason.
Cheers,
Marcus
> --
>
>