aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2003-03-26 14:55:44 +0000
committertradke <tradke@b61c5cb5-eaca-4651-9a7a-d64986f99364>2003-03-26 14:55:44 +0000
commitedfddf3ecad5377221c16ee6caa2988675b207bd (patch)
tree5e24bec1b12bd632c32d6c7e3e812675ae9c665d
parent0632fe26e28f6993841cabc26cc66ad0a2f1aa5d (diff)
Warn about allocation of zero-sized variable only if its global size is zero.
git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGH/PUGH/trunk@408 b61c5cb5-eaca-4651-9a7a-d64986f99364
-rw-r--r--src/Storage.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Storage.c b/src/Storage.c
index b97da14..d431a2b 100644
--- a/src/Storage.c
+++ b/src/Storage.c
@@ -833,7 +833,7 @@ static int PUGH_EnableGArrayGroupStorage (pGH *pughGH,
int padding_size,
int padding_address_spacing)
{
- int retval;
+ int i, global_size, retval;
/* avoid compiler warnings about unused parameters */
@@ -871,9 +871,17 @@ static int PUGH_EnableGArrayGroupStorage (pGH *pughGH,
if (GA->extras->npoints * GA->varsize <= 0)
{
- CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
- "PUGH_EnableGArrayDataStorage: Tried to allocate storage "
- "for zero-sized variable '%s'", GA->name);
+ /* only warn if the global array size is also zero */
+ for (i = 0, global_size = 1; i < GA->extras->dim; i++)
+ {
+ global_size *= GA->extras->nsize[i];
+ }
+ if (global_size <= 0)
+ {
+ CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING,
+ "PUGH_EnableGArrayDataStorage: Tried to allocate storage "
+ "for zero-sized variable '%s'", GA->name);
+ }
GA->data = GA->padddata = NULL;
}
else if (! padding_active)