Signal error on invalid constant type checking.

Side effet was SIGSEGV on compiled code.
This commit is contained in:
Fabrizio Fabbri 2017-06-28 14:30:23 +02:00
parent bfc58c219e
commit 6dc40c869c
No known key found for this signature in database
GPG key ID: 8276EDF3D10E6C35
2 changed files with 27 additions and 4 deletions

View file

@ -101,10 +101,17 @@
(c1checked-value (list (values-type-primary-type type)
value)))
((and (policy-evaluate-forms) (constantp value *cmp-env*))
(unless (typep (ext:constant-form-value value *cmp-env*) type)
(cmpwarn "Failed type assertion for value ~A and type ~A"
value type))
value)
(if (typep (ext:constant-form-value value *cmp-env*) type)
value
(progn
;; warn and generate error.
(cmpwarn "Failed type assertion for value ~A and type ~A"
value type)
(c1expr `(error 'simple-type-error
:datum ,value
:expected-type ',type
:format-control "The constant value ~S is not a ~S"
:format-arguments (list ,value ',type))))))
;; Is the form type contained in the test?
((progn
(setf form (c1expr value)