mescc: Make globals at least reg-size.

* module/mescc/compile.scm (global->info): Make globals at least reg-size.
This commit is contained in:
Jan Nieuwenhuizen 2018-10-06 15:36:32 +02:00
parent 51085ba25c
commit b456a32cf0
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273

View file

@ -2151,7 +2151,8 @@
(define (global->info type name o init info)
(let* ((rank (->rank type))
(size (->size type info))
(data (cond ((not init) (string->list (make-string size #\nul)))
(reg-size (->size "*" info))
(data (cond ((not init) (string->list (make-string (max size reg-size) #\nul)))
((c-array? type)
(let* ((string (array-init->string init))
(size (or (and string (max size (1+ (string-length string))))
@ -2164,7 +2165,7 @@
(append data (string->list (make-string (max 0 (- size (length data))) #\nul)))))
(else
(let ((data (init->data type init info)))
(append data (string->list (make-string (max 0 (- size (length data))) #\nul)))))))
(append data (string->list (make-string (max 0 (- (max size reg-size) (length data))) #\nul)))))))
(global (make-global-entry name type data)))
(clone info #:globals (append (.globals info) (list global)))))