Execute a type cast on an expression value.
(exec-cast tyname arg) → eval
We perform array-to-pointer conversion [C:5.3.2.1/3] on the operand.
Function:
(defun exec-cast (tyname arg) (declare (xargs :guard (and (tynamep tyname) (expr-valuep arg)))) (let ((__function__ 'exec-cast)) (declare (ignorable __function__)) (b* ((arg (apconvert-expr-value arg)) ((when (errorp arg)) arg) (val (eval-cast tyname (expr-value->value arg))) ((when (errorp val)) val)) (make-expr-value :value val :object nil))))
Theorem:
(defthm expr-value-resultp-of-exec-cast (b* ((eval (exec-cast tyname arg))) (expr-value-resultp eval)) :rule-classes :rewrite)
Theorem:
(defthm exec-cast-of-tyname-fix-tyname (equal (exec-cast (tyname-fix tyname) arg) (exec-cast tyname arg)))
Theorem:
(defthm exec-cast-tyname-equiv-congruence-on-tyname (implies (tyname-equiv tyname tyname-equiv) (equal (exec-cast tyname arg) (exec-cast tyname-equiv arg))) :rule-classes :congruence)
Theorem:
(defthm exec-cast-of-expr-value-fix-arg (equal (exec-cast tyname (expr-value-fix arg)) (exec-cast tyname arg)))
Theorem:
(defthm exec-cast-expr-value-equiv-congruence-on-arg (implies (expr-value-equiv arg arg-equiv) (equal (exec-cast tyname arg) (exec-cast tyname arg-equiv))) :rule-classes :congruence)