diff options
-rw-r--r-- | src/Storage.c | 16 |
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) |