mescc: Tinycc support: *global =.

* module/language/c99/compiler.mes (base->ident-address):
  Support *global = ...
* scaffold/tests/74-multi-line-string.c: Test it.
This commit is contained in:
Jan Nieuwenhuizen 2017-07-22 10:02:53 +02:00
parent 73726b2e27
commit 137547afa7
2 changed files with 12 additions and 1 deletions

View file

@ -412,7 +412,10 @@
(wrap-as (append (i386:local->accu (local:id local))
(if (= size 1) (i386:byte-base->accu-address)
(i386:byte-base->accu-address)))))
(error "TODO:base->ident-address-global" o)))))
(let ((size 4)) ;; FIXME
(wrap-as (append (i386:label-mem->accu `(#:address ,o))
(if (= size 1) (i386:byte-base->accu-address)
(i386:base->accu-address)))))))))
(define (value->ident info)
(lambda (o value)

View file

@ -28,6 +28,9 @@ char const* help =
" base"
" are";
int global_i = 1;
int *global_p = &global_i;
int
test ()
{
@ -36,5 +39,10 @@ test ()
int i = 1 | 2 | 4;
if (i != 7) return 1;
printf ("global_i=%d\n", global_i);
*global_p = 2;
printf ("global_i=%d\n", global_i);
if (global_i != 2) return global_i;
return 2,1,0;
}