From 9faca05e6a028915bc4d6e3b2e5993bdf1fc1ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= Date: Sun, 9 Jun 2019 17:46:31 +0200 Subject: [PATCH] test/ref/otccex: Fix ramdomly occurring segfault. The variables named tab and p are used in the context of pointers and thus must be declared as such. Determining the purpose they serve, using char over int seems more feasible here as well. --- test/ref/otccex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/ref/otccex.c b/test/ref/otccex.c index aa5df158f..645078ef0 100644 --- a/test/ref/otccex.c +++ b/test/ref/otccex.c @@ -58,7 +58,7 @@ long fact(n) /* Well, we could use printf, but it would be too easy */ print_num(long n,int b) { - int tab, p, c; + char *tab, *p, c; /* Numbers can be entered in decimal, hexadecimal ('0x' prefix) and octal ('0' prefix) */ /* more complex programs use malloc */ @@ -71,7 +71,7 @@ print_num(long n,int b) c = c + 'a' - 10; else c = c + '0'; - *(char *)p = c; + *p = c; p++; n = n / b; /* 'break' is supported */