debug mode gives memory overflow in memocc  [SOLVED]

option, parallelism,...

Moderators: fgoudreault, mcote

Forum rules
Please have a look at ~abinit/doc/config/build-config.ac in the source package for detailed and up-to-date information about the configuration of Abinit 8 builds.
For a video explanation on how to build Abinit 7.x for Linux, please go to: http://www.youtube.com/watch?v=DppLQ-KQA68.
IMPORTANT: when an answer solves your problem, please check the little green V-like button on its upper-right corner to accept it.
Locked
mverstra
Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

debug mode gives memory overflow in memocc

Post by mverstra » Tue Mar 29, 2011 11:25 pm

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
Matthieu Verstraete
University of Liege, Belgium

User avatar
pouillon
Posts: 651
Joined: Wed Aug 19, 2009 10:08 am
Location: Spain
Contact:

Re: debug mode gives memory overflow in memocc

Post by pouillon » Wed Mar 30, 2011 9:43 am

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.
Yann Pouillon
Simune Atomistics
Donostia-San Sebastián, Spain

mverstra
Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

Re: debug mode gives memory overflow in memocc

Post by mverstra » Thu Apr 07, 2011 9:21 pm

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.
Matthieu Verstraete
University of Liege, Belgium

User avatar
pouillon
Posts: 651
Joined: Wed Aug 19, 2009 10:08 am
Location: Spain
Contact:

Re: debug mode gives memory overflow in memocc

Post by pouillon » Fri Apr 08, 2011 12:07 pm

Then you just should remove the corresponding flag.
Yann Pouillon
Simune Atomistics
Donostia-San Sebastián, Spain

mverstra
Posts: 655
Joined: Wed Aug 19, 2009 12:01 pm

Re: debug mode gives memory overflow in memocc

Post by mverstra » Sat Apr 09, 2011 6:30 pm

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...
Matthieu Verstraete
University of Liege, Belgium

User avatar
pouillon
Posts: 651
Joined: Wed Aug 19, 2009 10:08 am
Location: Spain
Contact:

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

Post by pouillon » Tue Apr 12, 2011 5:10 pm

Sorry, I had misunderstood your point. I thought the padding size was coming from the debug flags.

Damien has been informed.
Yann Pouillon
Simune Atomistics
Donostia-San Sebastián, Spain

Locked