Open pramodk opened 2 years ago
For reference the address sanitizer on a Mac M1 gives:
% nocmodl *.mod
Translating cdp5_CR_CAM.mod into cdp5_CR_CAM.cpp
=================================================================
==17174==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x000103803d78 at pc 0x000100561d0c bp 0x00016f8ab790 sp 0x00016f8ab788
WRITE of size 8 at 0x000103803d78 thread T0
#0 0x100561d08 in massagekinetic(Item*, Item*, Item*, Item*, int) kinetic.cpp:479
#1 0x1005c09dc in yyparse() parse1.ypp:1057
#2 0x10056e794 in main modl.cpp:163
#3 0x100971088 in start+0x204 (dyld:arm64e+0x5088)
0x000103803d78 is located 8 bytes to the left of 240-byte region [0x000103803d80,0x000103803e70)
allocated by thread T0 here:
#0 0x100d73b58 in wrap_malloc+0x94 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x3fb58)
#1 0x10056d91c in emalloc(unsigned int) list.cpp:220
#2 0x1005618d8 in massagekinetic(Item*, Item*, Item*, Item*, int) kinetic.cpp:464
#3 0x1005c09dc in yyparse() parse1.ypp:1057
#4 0x10056e794 in main modl.cpp:163
#5 0x100971088 in start+0x204 (dyld:arm64e+0x5088)
Looking at the COMPARTMENT statements in the mod file I see that at least CR_1C_2N is listed twice. So I'm guessing eliminating duplicates will fix the issue. If it does, there should be an error message for duplicate STATE in a COMPARTMENT statement.
Hmm. After adding a printf for SYM(q1)->used - 1, I see that mg is declared as a STATE, and appears in a COMPARTMENT statement,but it does not appear in any kinetic equation. Making it ASSIGNED and removing it from the COMPARTMENT statement, then causes nocmodl to end with
Error: cao used in USEION statement can not be re-declared in a CONSTANT block at line 398 in file cdp5_CR_CAM.mod
^
Replacing the CONSTANT statement with ASSIGNED { cao (mM) }
allows nrnivodl to succeed and nrniv can load the dll.
Additional mechanisms from files
"cdp5_CR_CAM.mod"
oc>
Forgive the format but the above uses
COMPARTMENT diam*diam*vrat {ca Buff1 Buff1_ca Buff2 Buff2_ca
BTC BTC_ca DMNPE DMNPE_ca
CR
CR_0C_1N
CR_0C_2N
CR_1C_0N
CR_1C_1N
CR_1C_2N
CR_2C_0N
CR_2C_1N
CR_2C_2N
}
CR_1C_2N
Ops... CR_2C_1N is duplicated too. To much copy and past.
Back in 2019/2020 I had no issue compiling it but if it is not working correctly with the current version of NEURON, I'll update the model accordingly.
And CR_1V is missing from COMPARTMENT.
I have checked my models with NEURON 8.2.1, without the duplicated variables and with the missing one. The differences in physiological activity are negligible.
Thank you @pramodk
Overview of the issue
When trying to translate cdp5_CR_CAM.mod I see that nocmodl segfaults:
Looking at the backtrace I see:
This also happens with NEURON 8.0 release.
Expected result/behavior
MOD file should be translated without errors.
NEURON setup
Minimal working example - MWE
Logs
See above