Page 1 of 1

debug mode gives memory overflow in memocc

Posted: Tue Mar 29, 2011 11:25 pm
by mverstra
Hello all (Matteo? Yann? in particular?)

when turning on debug "naughty" you get segfaults inside memocc - the padding functions are being called with ndebug=5 on small arrays with less than 5 elements, which gives a negative address:

==4821== Invalid write of size 4
==4821== at 0x11C9DCB0: __m_profiling_NMOD_i_padding (memocc_cpp.f90:820)
==4821== by 0x11C9E280: __m_profiling_NMOD_mo_i1 (memocc_cpp.f90:1075)
==4821== by 0x11358BF0: __m_ab6_mixing_NMOD_ab6_mixing_new (m_ab6_mixing_cpp.f90:736)
==4821== by 0x10235F50: scfcv (scfcv_cpp.f90:1001)
==4821== by 0x100DD268: *scfcv_stub_in_scfcv_new (in /gpfs/storage/home/ulg32/ulg32347/CODES/ABINIT/6.7.1-private/tmp-seq/src/98_main/abinit)
==4821== by 0x100DEA64: scfcv_new (scfcv_new_cpp.f90:681)
==4821== by 0x101B46AC: gstate (gstate_cpp.f90:1374)
==4821== by 0x10041A0C: gstateimg (gstateimg_cpp.f90:840)
==4821== by 0x100110F4: driver (driver_cpp.f90:954)
==4821== by 0x100050FC: *driver_stub_in_abinit (abinit_cpp.f90:827)
==4821== by 0x10007290: main (abinit_cpp.f90:827)

ciao

Matthieu

Re: debug mode gives memory overflow in memocc

Posted: Wed Mar 30, 2011 9:43 am
by pouillon
Do you mean on IBM architecture with XLF 12?

If yes, the naughty flags have not been tested very well there. Feel free to adjust them.

Re: debug mode gives memory overflow in memocc

Posted: Thu Apr 07, 2011 9:21 pm
by mverstra
no - this has nothing to do with xlf I believe. The naughty level of abinit calls the debug routines, and the "5" is hard coded. If you pass it an array with less than 5 elements, it tries to pad them anyway and segfaults.

M.

Re: debug mode gives memory overflow in memocc

Posted: Fri Apr 08, 2011 12:07 pm
by pouillon
Then you just should remove the corresponding flag.

Re: debug mode gives memory overflow in memocc

Posted: Sat Apr 09, 2011 6:30 pm
by mverstra
Yes - as far as I am concerned, I just stopped using debug=naughty and I am fine, but this is an authentic bug - the number of padded elements should be checked to be <= the total number of elements...

Re: debug mode gives memory overflow in memocc  [SOLVED]

Posted: Tue Apr 12, 2011 5:10 pm
by pouillon
Sorry, I had misunderstood your point. I thought the padding size was coming from the debug flags.

Damien has been informed.