diff --git a/module/language/c99/compiler.mes b/module/language/c99/compiler.mes index 91d60269..5a9a9754 100644 --- a/module/language/c99/compiler.mes +++ b/module/language/c99/compiler.mes @@ -1925,7 +1925,7 @@ (info (append-text info (ast->comment o))) (globals (append globals initzer-globals)) (info (clone info #:globals globals)) - (pointer (if (and (pair? type) (equal? (car type) "tag")) -1 pointer)) + (pointer (if (and (zero? pointer) (pair? type) (equal? (car type) "tag")) -1 pointer)) (size (if (zero? pointer) (ast-type->size info type) 4))) (if (.function info) diff --git a/scaffold/tests/23-pointer.c b/scaffold/tests/23-pointer.c index c8e2694f..e16cb079 100644 --- a/scaffold/tests/23-pointer.c +++ b/scaffold/tests/23-pointer.c @@ -23,6 +23,12 @@ char g_arena[4] = "XXX"; char *g_chars = g_arena; +struct foo { + int fd; +}; + +struct foo *file; + int test () { @@ -46,5 +52,9 @@ test () char **pp2 = *ppp; if (**pp2 != 'X') return 8; + struct foo *f = 0; + if (f) return 9; + if (file) return 10; + return 0; }