Skip to content

Fix segfault in initialization

William Dawson requested to merge init_seg into devel

There is a segfault that can be triggered by using this input file:

dft: {hgrids: 0.45, ixc: PBE}
output: {orbitals: binary}
posinp:
  cell: [.inf, .inf, .inf]
  positions:
  - C: [16.799999, 16.799999, 19.6]
    frag: [ATM, '0']
  - O: [17.399998000000004, 17.399998000000004, 20.344999]
    frag: [ATM, '1']
  units: angstroem

To see it, compile with something like -fcheck=all. The error you will get is:

 <BigDFT> log of the run will be written in logfile: ./log-CO_gga.yaml
 <BigDFT> Logfile existing, renamed into: ./logfiles/log-CO_gga.16:37:38.100.yaml
At line 808 of file /home/wddawson/Documents/devel/bigdft-suite/bigdft/src/init/sysprop.f90
Fortran runtime error: Pointer actual argument 'ref_frags' is not associated

Error termination. Backtrace:
 there
#0  0x7fc55ee23960 in ???
#1  0x7fc55ee244d9 in ???
#2  0x7fc55ee24ad6 in ???
#3  0x55ca97d79a55 in fragment_stuff
	at /home/wddawson/Documents/devel/bigdft-suite/bigdft/src/init/sysprop.f90:808
#4  0x55ca97d7f295 in system_initialization_
	at /home/wddawson/Documents/devel/bigdft-suite/bigdft/src/init/sysprop.f90:327
#5  0x55ca97db446d in cluster_
	at /home/wddawson/Documents/devel/bigdft-suite/bigdft/src/cluster.f90:397
#6  0x55ca97c201d9 in quantum_mechanical_state
	at /home/wddawson/Documents/devel/bigdft-suite/bigdft/src/modules/bigdft_run.f90:2201
#7  0x55ca97c2b9a1 in __bigdft_run_MOD_bigdft_state
	at /home/wddawson/Documents/devel/bigdft-suite/bigdft/src/modules/bigdft_run.f90:1980
#8  0x55ca97c30660 in __bigdft_run_MOD_process_run
	at /home/wddawson/Documents/devel/bigdft-suite/bigdft/src/modules/bigdft_run.f90:2084
#9  0x55ca97c1bde5 in bigdft
	at /home/wddawson/Documents/devel/bigdft-suite/bigdft/src/BigDFT.f90:52
#10  0x55ca97c1bb5e in main
	at /home/wddawson/Documents/devel/bigdft-suite/bigdft/src/BigDFT.f90:12

I'm not sure if this is the correct fix, but at any rate it prevents the error.

Merge request reports