aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/preproc/variable.c')
-rw-r--r--src/interfaces/ecpg/preproc/variable.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c
index 9fa2ec8a6c9..f295d177d9c 100644
--- a/src/interfaces/ecpg/preproc/variable.c
+++ b/src/interfaces/ecpg/preproc/variable.c
@@ -512,7 +512,14 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
/* one index is the string length */
if (atoi(*length) < 0)
{
- *length = (atoi(*dimension) < 0) ? make_str("1") : *dimension;
+ /* make sure we return length = -1 for arrays without given bounds */
+ if (atoi(*dimension) < 0)
+ *length = make_str("1");
+ else if (atoi(*dimension) == 0)
+ *length = make_str("-1");
+ else
+ *length = *dimension;
+
*dimension = make_str("-1");
}
break;