Fortran API + local arrays + set_selection leads to segfault
Created by: pnorbert
Describe the bug
The Fortran API supports defining local arrays by using the constant adios2_null_dims
in both shape and start. When changing the size of the local array later with
adios2_set_selection(var, 2, adios2_null_dims, (/ nsan, 3 /))
then the code will segfault during write.
The problem is that the Fortran function for set_selection does not handle adios2_null_dims and will pass a {-1,0} vector to the C++ API, which then will change the variable. Offset from empty vector to this non-empty vector. `adios2_f2c_variable.cpp:adios2_set_selection_f2c(), line 175.
During writing, in BPSerializer::PutDimensionsRecord() the false branch is executed (believing it's a global array) and BPSerializer.cpp:228 will segfault.
It is not clear to me, which of these functions should be fixed and whether the fix would cause a side effect unknown to me, especially in the serializer.
To Reproduce A test needs to be written. The existing fortran local array test needs to be extended with using adios2_set_selection().