Skip to content

Add stf and fof as options to write_output_field_parameter

Josh Borrow requested to merge fix_output_options_segfault into master

Fixes a segfault that occured when running with -o:

lldb -- ../../swift --cosmology  --threads=2 -o eagle_xl_params.yml eagle_6.yml 
(lldb) target create "../../swift"
Current executable set to '../../swift' (x86_64).
(lldb) settings set -- target.run-args  "--cosmology" "--threads=2" "-o" "eagle_xl_params.yml" "eagle_6.yml"
(lldb) r
Process 32663 launched: '/Users/mphf18/Documents/swift/swiftsim/examples/swift' (x86_64)
 Welcome to the cosmological hydrodynamical code
    ______       _________________
   / ___/ |     / /  _/ ___/_  __/
   \__ \| | /| / // // /_   / /   
  ___/ /| |/ |/ // // __/  / /    
 /____/ |__/|__/___/_/    /_/     
 SPH With Inter-dependent Fine-grained Tasking

 Version : 0.9.0
 Revision: v0.9.0-251-gec48bf02, Branch: master, Date: 2021-01-27 10:48:37 +0100
 Webpage : www.swiftsim.com

 Config. options: '--with-subgrid=EAGLE-XL --disable-mpi CFLAGS=-fno-stack-check --enable-debug'

 Compiler: LLVM/Clang, Version: 11.0.0
 CFLAGS  : '-g -O0 -fno-stack-check -O3 -fomit-frame-pointer -fstrict-aliasing -ffast-math -funroll-loops -march=skylake -mavx2 -pthread -Wall -Wextra -Wno-unused-parameter -Wshadow -Werror -Wstrict-prototypes'

 HDF5 library version     : 1.10.5
 FFTW library version     : 3.x (details not available)
 GSL library version      : 2.5

swift was compiled with optimization - stepping may behave oddly; variables may not be available.
Process 32663 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x8)
    frame #0: 0x00000001000a6358 swift`io_select_dm_fields(gparts=<unavailable>, with_fof=<unavailable>, with_stf=1, e=0x0000000000000000, num_fields=0x00007ffeefbe5374, list=0x00007ffeefbe54a0) at common_io.c:1532:38 [opt]
   1529	  }
   1530	  if (with_stf) {
   1531	    *num_fields +=
-> 1532	        velociraptor_write_gparts(e->s->gpart_group_data, list + *num_fields);
   1533	  }
   1534	}
   1535	

with_stf was always passed as 1 to this function, even when it was not enabled. If fof is not enabled, then gpart_group_data is never initialized.

Merge request reports