mescc: Tinycc support: bugfix struct pointer.
* module/language/c99/compiler.mes (decl->info): Only set non-pointer struct to -1. * scaffold/tests/23-pointer.c (test): Test it.
This commit is contained in:
parent
10e65b35ce
commit
d2f701b825
|
@ -1925,7 +1925,7 @@
|
||||||
(info (append-text info (ast->comment o)))
|
(info (append-text info (ast->comment o)))
|
||||||
(globals (append globals initzer-globals))
|
(globals (append globals initzer-globals))
|
||||||
(info (clone info #:globals 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)
|
(size (if (zero? pointer) (ast-type->size info type)
|
||||||
4)))
|
4)))
|
||||||
(if (.function info)
|
(if (.function info)
|
||||||
|
|
|
@ -23,6 +23,12 @@
|
||||||
char g_arena[4] = "XXX";
|
char g_arena[4] = "XXX";
|
||||||
char *g_chars = g_arena;
|
char *g_chars = g_arena;
|
||||||
|
|
||||||
|
struct foo {
|
||||||
|
int fd;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct foo *file;
|
||||||
|
|
||||||
int
|
int
|
||||||
test ()
|
test ()
|
||||||
{
|
{
|
||||||
|
@ -46,5 +52,9 @@ test ()
|
||||||
char **pp2 = *ppp;
|
char **pp2 = *ppp;
|
||||||
if (**pp2 != 'X') return 8;
|
if (**pp2 != 'X') return 8;
|
||||||
|
|
||||||
|
struct foo *f = 0;
|
||||||
|
if (f) return 9;
|
||||||
|
if (file) return 10;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue