SodShock_1D (and possibly all other 1D tests) is broken
SodShock_1D
crashes with the following error (Gadget2 hydro, nothing fancy):
bwvdnbro@sakkee:~/Programs/swiftsim/examples/SodShock_1D$ ./run.sh
Welcome to the cosmological hydrodynamical code
______ _________________
/ ___/ | / / _/ ___/_ __/
\__ \| | /| / // // /_ / /
___/ /| |/ |/ // // __/ / /
/____/ |__/|__/___/_/ /_/
SPH With Inter-dependent Fine-grained Tasking
Version : 0.5.0
Revision: v0.5.0-882-ge240f03b, Branch: disc_patch_x, Date: 2017-07-25 09:56:47 +0100
Webpage : www.swiftsim.com
Config. options: '--with-hydro=gadget2 --with-riemann-solver=exact --disable-vec --with-hydro-dimension=1 --enable-mpi=no --with-ext-potential=none --with-equation-of-state=ideal-gas --enable-debug=yes --enable-debugging-checks=yes --enable-optimization=no --enable-sanitizer=yes'
Compiler: GCC, Version: 5.4.0
CFLAGS : '-g -O0 -gdwarf -fvar-tracking-assignments -fsanitize=address -fno-omit-frame-pointer -pthread -Wall -Wextra -Wno-unused-parameter -Werror'
HDF5 library version: 1.8.16
[00000.0] main: CPU frequency used for tick conversion: 2492997679 Hz
[00000.0] main: Running on: sakkee
[00000.0] main: WARNING: Debugging checks activated. Code will be slower !
[00000.0] main: sizeof(part) is 160 bytes.
[00000.0] main: sizeof(xpart) is 64 bytes.
[00000.0] main: sizeof(spart) is 96 bytes.
[00000.0] main: sizeof(gpart) is 128 bytes.
[00000.0] main: sizeof(multipole) is 160 bytes.
[00000.0] main: sizeof(grav_tensor) is 288 bytes.
[00000.0] main: sizeof(task) is 64 bytes.
[00000.0] main: sizeof(cell) is 672 bytes.
[00000.0] main: Reading runtime parameters from file 'sodShock.yml'
[00000.0] main: Reading ICs from file './sodShock.hdf5'
[00000.0] read_ic_single: IC and internal units match. No conversion needed.
[00000.0] main: Reading initial conditions took 2.740 ms.
[00000.0] main: Read 900 gas particles, 0 star particles and 0 gparts from the ICs.
[00000.0] space_regrid: (re)griding space cdim=(12 12 12)
[00000.0] main: space_init took 0.879 ms.
[00000.0] main: space dimensions are [ 2.000 2.000 2.000 ].
[00000.0] main: space is periodic.
[00000.0] main: highest-level cell dimensions are [ 12 12 12 ].
[00000.0] main: 900 parts in 1728 cells.
[00000.0] main: 0 gparts in 1728 cells.
[00000.0] main: 0 sparts in 1728 cells.
[00000.0] main: maximum depth is 0.
[00000.0] engine_init: no processor affinity used
[00000.0] engine_policy: engine policies are [ steal keep numa_affinity hydro ]
[00000.0] hydro_props_print: Equation of state: Ideal gas.
[00000.0] hydro_props_print: Adiabatic index gamma: 1.666667.
[00000.0] hydro_props_print: Hydrodynamic scheme: Gadget-2 version of SPH (Springel 2005) in 1D.
[00000.0] hydro_props_print: Hydrodynamic kernel: Cubic spline (M4) with eta=1.234800 (4.28 neighbours).
[00000.0] hydro_props_print: Hydrodynamic tolerance in h: 0.00010 (+/- 0.0004 neighbours).
[00000.0] hydro_props_print: Hydrodynamic integration: CFL parameter: 0.1000.
[00000.0] hydro_props_print: Hydrodynamic integration: Max change of volume: 1.40 (max|dlog(h)/dt|=0.336472).
[00000.0] engine_init: Absolute minimal timestep size: 1.387779e-18
[00000.0] engine_init: Minimal timestep size (on time-line): 9.536743e-08
[00000.0] engine_init: Maximal timestep size (on time-line): 6.250000e-03
[00000.0] main: engine_init took 1.177 ms.
[00000.0] main: Running on 900 gas particles, 0 star particles and 0 DM particles (0 gravity particles)
[00000.0] main: from t=0.000e+00 until t=2.000e-01 with 1 threads and 1 queues (dt_min=1.000e-07, dt_max=1.000e-02)...
[00000.0] engine_init_particles: Computing initial gas densities.
[00000.0] space_rebuild: (re)building space
=================================================================
==29750==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f74e7e98ac0 at pc 0x000000460056 bp 0x7ffe7b0b9780 sp 0x7ffe7b0b9770
READ of size 4 at 0x7f74e7e98ac0 thread T0
#0 0x460055 in engine_init_particles /home/bwvdnbro/Programs/swiftsim/src/engine.c:3415
#1 0x4057f8 in main /home/bwvdnbro/Programs/swiftsim/examples/main.c:645
#2 0x7f74e5e9082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#3 0x403398 in _start (/home/bwvdnbro/Programs/swiftsim/examples/swift+0x403398)
0x7f74e7e98ac0 is located 64 bytes to the right of 144000-byte region [0x7f74e7e75800,0x7f74e7e98a80)
allocated by thread T0 here:
#0 0x7f74e6ea1076 in __interceptor_posix_memalign (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99076)
#1 0x4814cc in read_ic_single /home/bwvdnbro/Programs/swiftsim/src/single_io.c:461
#2 0x404b93 in main /home/bwvdnbro/Programs/swiftsim/examples/main.c:469
#3 0x7f74e5e9082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
SUMMARY: AddressSanitizer: heap-buffer-overflow /home/bwvdnbro/Programs/swiftsim/src/engine.c:3415 engine_init_particles
Shadow bytes around the buggy address:
0x0fef1cfcb100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fef1cfcb110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fef1cfcb120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fef1cfcb130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0fef1cfcb140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0fef1cfcb150: fa fa fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa
0x0fef1cfcb160: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fef1cfcb170: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fef1cfcb180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fef1cfcb190: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0fef1cfcb1a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
==29750==ABORTING
The error seems to be caused by engine.c:3415
. It is not at all obvious to me what the issue could be. The error also affects other 1D tests.