[Carpet] grid array is NULL pointer after DECLARE_CCTK_ARGUMENTS in local mode?
Jonathan Thornburg
jthorn at aei.mpg.de
Sun Nov 5 16:45:25 CET 2006
I'm trying to debug a Cactus run which crashes, and I wonder if anyone
can suggest what might be going wrong.
I can reproduce the crash in a uniprocessor DEBUG=yes OPTIMISE=no
executable, and I have a stack traceback from gdb. The thorn where the
crash occurs has the following schedule.ccl:
storage: AH_shape
storage: AH_origin
storage: AH_ever_found
storage: AH_found
storage: AH_appearance_time
storage: AH_rmin, AH_rmax
schedule AHUtil_reset_vars at basegrid
{
lang: C
} "reset variables"
The interface.ccl declares the relevant grid array like this:
cctk_int AH_ever_found[101] type=scalar "this is to tell if a given AH has ever been found"
The source code reads (in part) as follows:
extern "C" void AHUtil_reset_vars(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
// initialize AH-related variables
memset(AH_ever_found, 0, 100*sizeof(CCTK_INT));
The crash occurs becaue the value of AH_ever_found is a NULL pointer
at the memset call. :( I have verified this both in the core-dump
and by running cactus under gdb.
>From looking at the grid::[xyzr] grid functons inside gdb, the current
grid is the coarsest refinement level.
So... questions:
I had thought that with storage turned on outside any schedule block,
AH_ever_found would always be a non-NULL pointer. Obviously I'm wrong.
Is it supposed to be this way? That is, is this a Cactus/Carpet feature,
or a bug in some piece of software (possibly corrupting memory and
confusing things)?
ciao,
--
-- Jonathan Thornburg <jthorn at aei.mpg.de>
Max-Planck-Institut fuer Gravitationsphysik (Albert-Einstein-Institut),
Golm, Germany, "Old Europe" http://www.aei.mpg.de/~jthorn/home.html
"Washing one's hands of the conflict between the powerful and the
powerless means to side with the powerful, not to be neutral."
-- quote by Freire / poster by Oxfam
More information about the developers
mailing list