dbcsr icon indicating copy to clipboard operation
dbcsr copied to clipboard

Dangling pointer referenced in dbcsr_mm_multrec.F

Open vzecca opened this issue 3 years ago • 0 comments

Running many test cases of cp2k, among them xTB/regtest-3/h2o_rtp.inp, in dbcsr_mm_multrec.F line 518

CALL dbcsr_mm_csr_multiply(this%csr, left, right, & ... use_eps=this%use_eps, row_max_epss=this%row_max_epss, &

the dangling pointer this%row_max_epss is referenced.

The pointer was returned by the procedure dbcsr_mm_multrec_init. I think this is because inside the procedure at line 232 the following instruction

this%row_max_epss => row_max_epss

pointing to a local pointer, makes it dangling at procedure exit. This pointer assignment should be executed outside the procedure, as in

if(multrec(ithread)%p%use_eps) multrec(ithread)%p%row_max_epss=>row_max_epss

after row_max_epss is declared TARGET

vzecca avatar May 04 '21 06:05 vzecca