changeset 48:dc0bcee2c847

bugfix: value and control-group arrays need to be max-arg size + 1 (... futher cleanup is needed as index 0 in array is not used at all ;-/ )
author Daniel Adler <dadler@dyncall.org>
date Sat, 19 Dec 2015 23:04:42 +0000
parents b8f16ad80e34
children 4388e27eadd7
files test/call_suite/globals.c
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test/call_suite/globals.c	Sat Dec 19 16:19:15 2015 +0100
+++ b/test/call_suite/globals.c	Sat Dec 19 23:04:42 2015 +0000
@@ -38,10 +38,10 @@
 void init_K()
 {
   int i;
-#define X(CH,T,QCH) V_##CH = (T*) malloc(sizeof(T)*G_maxargs); K_##CH = (T*) malloc(sizeof(T)*G_maxargs);
+#define X(CH,T,QCH) V_##CH = (T*) malloc(sizeof(T)*(G_maxargs+1)); K_##CH = (T*) malloc(sizeof(T)*(G_maxargs+1));
 DEF_TYPES
 #undef X
-  for(i=0;i<G_maxargs;++i) {
+  for(i=0;i<G_maxargs+1;++i) {
     K_c[i] = (char)      (((rand_d()-0.5)*2) * (1<<7));
     K_s[i] = (short)     (((rand_d()-0.5)*2) * (1<<(sizeof(short)*8-1)));
     K_i[i] = (int)       (((rand_d()-0.5)*2) * (1<<(sizeof(int)*8-2)));
@@ -56,7 +56,7 @@
 void clear_V()
 {
   int i;
-  for(i=0;i<G_maxargs;++i) {
+  for(i=0;i<G_maxargs+1;++i) {
 #define X(CH,T,QCH) V_##CH[i] = (T) 0;
 DEF_TYPES
 #undef X