mpi_enreg is not initialized

Moderator: pouillon

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

mpi_enreg is not initialized

Post by mverstra » Sun Jun 05, 2011 8:38 pm

For the moment, if MPI is not defined, the mpi_enreg contents are basically not allocated.

They are then used, e.g. within cgwf.F90:408

if ((wfopta10==1).and.(mpi_enreg%paralbd>=1).and.&
& (mpi_enreg%proc_distrb(ikpt,iband,isppol)/=me_distrb).and.&
(mpi_enreg%me_group/=0)) cycle

This test does not wait to see if mpi is being used before accessing the elements of mpi_enreg, which are either not allocated or filled with garbage. Very ugly, people. I also use initialization to very large values for int and float, which brings out all these nasty things.

I will segregate the first 2 tests and the latter ones, but this should be avoided at all costs, across the whole code.

Could be tested for on some buildbot, checking for use of uninitialized or unallocated variables.

ciao

Matthieu
Matthieu Verstraete
University of Liege, Belgium

Locked