Page 1 of 1

mpi_enreg is not initialized

Posted: Sun Jun 05, 2011 8:38 pm
by mverstra
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