[ET Trac] #2741: Some thorns seem to incorrectly use CCTK_GFINDEX4D
Gabriele Bozzola
trac-noreply at einsteintoolkit.org
Fri Jun 9 10:29:47 CDT 2023
#2741: Some thorns seem to incorrectly use CCTK_GFINDEX4D
Reporter: Gabriele Bozzola
Status: new
Milestone:
Version:
Type: bug
Priority: major
Component: EinsteinToolkit thorn
A student in my group found the following problem in `ID_converter_ILGRMHD`:
If you compile Einstein Toolkit in debug mode, the code crashes. This is due to the function `CCTK_GFINDEX4D` that is used in some thorns \(such as `ID_converter_ILGRMHD`\). The function is used to unroll a vector index into a linear one:
```c
int CCTK_GFIndex4D (const cGH *GH, int i, int j, int k, int l)
{
#ifdef CCTK_DEBUG
if (i < 0 || i >= GH->cctk_lsh[0] ||
j < 0 || j >= GH->cctk_lsh[1] ||
k < 0 || k >= GH->cctk_lsh[2] ||
l < 0 || l >= GH->cctk_lsh[3])
{
CCTK_VError (__LINE__, __FILE__, "Cactus",
"Grid function index out of bounds. i=%d j=%d k=%d l=%d cctk_lsh=[%d,%d,%d,%d]",
i, j, k, l, GH->cctk_lsh[0], GH->cctk_lsh[1], GH->cctk_lsh[2], GH->cctk_lsh[3]);
}
#endif
return (i + GH->cctk_ash[0]*(j + GH->cctk_ash[1]*(k + GH->cctk_ash[2] * l)));
}
```
The code crashes when `CCTK_DEBUG` because cctk\_lsh\[3\] is 0, so the conditional in line 7 is not satisfied.
To reproduce, run `magnetizedTOV.par `in IllinoisGRMHD with `CCTK_DEBUG` enabled.
--
Ticket URL: https://bitbucket.org/einsteintoolkit/tickets/issues/2741/some-thorns-seem-to-incorrectly-use
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.einsteintoolkit.org/pipermail/trac/attachments/20230609/2228e1d0/attachment.htm>
More information about the Trac
mailing list