CoreNeuron icon indicating copy to clipboard operation
CoreNeuron copied to clipboard

valgrind reports invalid read of size 4 in fill_multisend_lists

Open alkino opened this issue 4 years ago • 4 comments

Here is a valgrind output after running tqperf on master.

valgrind ./x86_64/special-core --mpi -e 50 -d coredat --multisend -o tqperf

Those 2 errors seems to be due to an id set to -1.

==172614== Invalid read of size 4
==172614==    at 0x4A563B7: coreneuron::fill_multisend_lists(int, int, int*, int*&, int*&) (multisend_setup.cpp:422)
==172614==    by 0x4A55D20: coreneuron::nrn_multisend_setup_targets(bool, int*&, int*&) (multisend_setup.cpp:307)
==172614==    by 0x4A55432: coreneuron::nrn_multisend_setup() (multisend.cpp:450)
==172614==    by 0x4A18858: coreneuron::determine_inputpresyn() (nrn_setup.cpp:631)
==172614==    by 0x4A18F15: coreneuron::nrn_setup(char const*, bool, bool, bool, char const*, char const*, double*) (nrn_setup.cpp:770)
==172614==    by 0x4A07D96: coreneuron::nrn_init_and_load_data(int, char**, bool, bool, bool) (main1.cpp:252)
==172614==    by 0x4A087DD: run_solve_core (main1.cpp:460)
==172614==    by 0x484A37E: solve_core (enginemech.cpp:40)
==172614==    by 0x109175: main (coreneuron.cpp:34)
==172614==  Address 0x92a2fbc is 4 bytes before a block of size 0 alloc'd
==172614==    at 0x483A50F: operator new[](unsigned long) (vg_replace_malloc.c:433)
==172614==    by 0x4A55F9E: coreneuron::fill_multisend_lists(int, int, int*, int*&, int*&) (multisend_setup.cpp:365)
==172614==    by 0x4A55D20: coreneuron::nrn_multisend_setup_targets(bool, int*&, int*&) (multisend_setup.cpp:307)
==172614==    by 0x4A55432: coreneuron::nrn_multisend_setup() (multisend.cpp:450)
==172614==    by 0x4A18858: coreneuron::determine_inputpresyn() (nrn_setup.cpp:631)
==172614==    by 0x4A18F15: coreneuron::nrn_setup(char const*, bool, bool, bool, char const*, char const*, double*) (nrn_setup.cpp:770)
==172614==    by 0x4A07D96: coreneuron::nrn_init_and_load_data(int, char**, bool, bool, bool) (main1.cpp:252)
==172614==    by 0x4A087DD: run_solve_core (main1.cpp:460)
==172614==    by 0x484A37E: solve_core (enginemech.cpp:40)
==172614==    by 0x109175: main (coreneuron.cpp:34)
==172614== Invalid read of size 4
==172614==    at 0x4A563F5: coreneuron::fill_multisend_lists(int, int, int*, int*&, int*&) (multisend_setup.cpp:425)
==172614==    by 0x4A55D20: coreneuron::nrn_multisend_setup_targets(bool, int*&, int*&) (multisend_setup.cpp:307)
==172614==    by 0x4A55432: coreneuron::nrn_multisend_setup() (multisend.cpp:450)
==172614==    by 0x4A18858: coreneuron::determine_inputpresyn() (nrn_setup.cpp:631)
==172614==    by 0x4A18F15: coreneuron::nrn_setup(char const*, bool, bool, bool, char const*, char const*, double*) (nrn_setup.cpp:770)
==172614==    by 0x4A07D96: coreneuron::nrn_init_and_load_data(int, char**, bool, bool, bool) (main1.cpp:252)
==172614==    by 0x4A087DD: run_solve_core (main1.cpp:460)
==172614==    by 0x484A37E: solve_core (enginemech.cpp:40)
==172614==    by 0x109175: main (coreneuron.cpp:34)
==172614==  Address 0x92a2fc0 is 0 bytes after a block of size 0 alloc'd
==172614==    at 0x483A50F: operator new[](unsigned long) (vg_replace_malloc.c:433)
==172614==    by 0x4A55F9E: coreneuron::fill_multisend_lists(int, int, int*, int*&, int*&) (multisend_setup.cpp:365)
==172614==    by 0x4A55D20: coreneuron::nrn_multisend_setup_targets(bool, int*&, int*&) (multisend_setup.cpp:307)
==172614==    by 0x4A55432: coreneuron::nrn_multisend_setup() (multisend.cpp:450)
==172614==    by 0x4A18858: coreneuron::determine_inputpresyn() (nrn_setup.cpp:631)
==172614==    by 0x4A18F15: coreneuron::nrn_setup(char const*, bool, bool, bool, char const*, char const*, double*) (nrn_setup.cpp:770)
==172614==    by 0x4A07D96: coreneuron::nrn_init_and_load_data(int, char**, bool, bool, bool) (main1.cpp:252)
==172614==    by 0x4A087DD: run_solve_core (main1.cpp:460)
==172614==    by 0x484A37E: solve_core (enginemech.cpp:40)
==172614==    by 0x109175: main (coreneuron.cpp:34)

alkino avatar Apr 17 '20 14:04 alkino

Oh ok...I didn’t notice this issue before. I assume then these errors persists after merge of your PR as well?

pramodk avatar Apr 22 '20 05:04 pramodk

Yes

alkino avatar Apr 22 '20 08:04 alkino

It's in a part not related to my patch

alkino avatar Apr 22 '20 08:04 alkino

Possibly related to https://github.com/BlueBrain/nmodl/issues/680

olupton avatar Jun 29 '21 15:06 olupton

This is fixed here: https://github.com/BlueBrain/nmodl/commit/6678d8e895ca0b808f43c6f0183d6fac12986e95

alkino avatar Aug 18 '22 11:08 alkino