mescc: Tinycc support: *global =.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sat, 22 Jul 2017 08:02:53 +0000 (10:02 +0200)
committerJan Nieuwenhuizen <janneke@gnu.org>
Wed, 26 Jul 2017 09:36:08 +0000 (11:36 +0200)
* module/language/c99/compiler.mes (base->ident-address):
  Support *global = ...
* scaffold/tests/74-multi-line-string.c: Test it.

module/language/c99/compiler.mes
scaffold/tests/74-multi-line-string.c

index 998548fb7e86ecbafdbc5ae971a77563057da266..3105e4adafeb133c71f13dd025d0818c65670bdd 100644 (file)
             (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)
index 28c54e2c8d68fc7ddf806dad21d522a9762b9551..93af9c607d91198471c1f3255fd6b7ffac3aaa5a 100644 (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;
 }