I see invalid read messages from valgrind (3.6.1 on 64-bit Linux) -
the location in question is well within a buffer that was allocated
via malloc/realloc, as the message below indicates as well. As this
invalid read happens inside a library, I tried putting a memcpy just
before the library call to see if I was able to read from those
addresses without valgrind throwing an error and surprisingly,
valgrind didn't complain for my memcpy. {buf = malloc(756);
memcpy(buf, buf_arg_of_mpi_send, 756); }
was the code I inserted.==14178== Invalid read of size 2 ==14178== at 0x4A094C0: memcpy@@GLIBC_2.14 (mc_replace_strmem.c:653) ==14178== by 0x367B2D3C28: opal_convertor_pack (in /usr/lib64/openmpi/lib/libmpi.so.1.0.2) ==14178== by 0x944627B: ??? (in /usr/lib64/openmpi/lib/openmpi/mca_btl_sm.so) ==14178== by 0x83E77E7: ??? (in /usr/lib64/openmpi/lib/openmpi/mca_pml_ob1.so) ==14178== by 0x83DED1C: ??? (in /usr/lib64/openmpi/lib/openmpi/mca_pml_ob1.so) ==14178== by 0x367B26522E: PMPI_Isend (in /usr/lib64/openmpi/lib/libmpi.so.1.0.2) ==14178== by 0x403C82: main (in /examples/1d/distopt) ==14178== Address 0x8b3256e is 750 bytes inside a block of size 40,704 alloc'd ==14178== at 0x4A074CD: malloc (vg_replace_malloc.c:236) ==14178== by 0x4A07657: realloc (vg_replace_malloc.c:525) ==14178== by 0x4C10074: rt_max_alloc (polyrt.c:139) ==14178== by 0x401D6F: main (in /examples/1d/distopt) Why was the read shown as invalid here? The block was on the heap; could it have been made unaddressable some way by code that executed within PMPI_Isend? Thanks. ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ Valgrind-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/valgrind-users
