Incorrect assert in Carpet/src/modes.cc
Issue #2655
resolved
In Carpet/src/modes.cc, there is a block of asserts
assert(cctkGH->cctk_lsh[d] >= 0);
assert(cctkGH->cctk_lsh[d] <= cctkGH->cctk_gsh[d]);
assert(cctkGH->cctk_lbnd[d] >= 0);
assert(cctkGH->cctk_lbnd[d] <= cctkGH->cctk_ubnd[d] + 1);
assert(cctkGH->cctk_ubnd[d] < cctkGH->cctk_gsh[d]);
assert(cctkGH->cctk_lbnd[d] + cctkGH->cctk_lsh[d] - 1 ==
cctkGH->cctk_ubnd[d]);
assert(cctkGH->cctk_lbnd[d] <= cctkGH->cctk_ubnd[d] + 1);
assert(cctkGH->cctk_lsh[d] <= cctkGH->cctk_ash[d]);
#ifdef CCTK_HAVE_CGH_TILE
assert(cctkGH->cctk_tile_min[d] == 0);
assert(cctkGH->cctk_tile_max[d] = cctkGH->cctk_lsh[d]);
#endif
assert(cctkGH->cctk_from[d] >= 0);
assert(cctkGH->cctk_from[d] <= cctkGH->cctk_to[d]);
assert(cctkGH->cctk_to[d] <= cctkGH->cctk_lsh[d]);
Inside the #ifdef, the second assert
assert(cctkGH->cctk_tile_max[d] = cctkGH->cctk_lsh[d]);
is setting the value instead of doing a comparison. This is definitely wrong and should be changed.
Comments (4)
-
reporter -
that would be very wrong. It should be:
assert(cctkGH->cctk_tile_min[d] == 0); assert(cctkGH->cctk_tile_max[d] == cctkGH->cctk_lsh[d]);
as far as I can tell (Carpet not actually supporting tiles). Deleting is not an option.
-
reporter I made a PR. Please review and apply. Since this is such a simple fix, if I have something similar in the future should I just merge the PR automatically or still go through the full process?
-
reporter - changed status to resolved
Fix merged into master.
- Log in to comment
@Steven R. Brandt has suggested that perhaps it can simply be deleted. @Roland Haas @Erik Schnetter Do either of you have opinions on this?