X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcompiler%2Fir1opt.lisp;h=f2152d36ad3eedd6bbcebdb9d059aa364d17149e;hb=673234cb910923d41badca51b383e3188f375691;hp=7e83244f2761bc907c241c9f529084f90a60a257;hpb=aa6ba297065841d20261cbe3cece624465d0edf1;p=sbcl.git diff --git a/src/compiler/ir1opt.lisp b/src/compiler/ir1opt.lisp index 7e83244..f2152d3 100644 --- a/src/compiler/ir1opt.lisp +++ b/src/compiler/ir1opt.lisp @@ -637,6 +637,14 @@ #!+sb-show (defvar *show-transforms-p* nil) +(defun check-important-result (node info) + (when (and (null (node-lvar node)) + (ir1-attributep (fun-info-attributes info) important-result)) + (let ((*compiler-error-context* node)) + (compiler-style-warn + "The return value of ~A should not be discarded." + (lvar-fun-name (basic-combination-fun node)))))) + ;;; Do IR1 optimizations on a COMBINATION node. (declaim (ftype (function (combination) (values)) ir1-optimize-combination)) (defun ir1-optimize-combination (node) @@ -661,6 +669,7 @@ (when arg (setf (lvar-reoptimize arg) nil))) (when info + (check-important-result node info) (let ((fun (fun-info-destroyed-constant-args info))) (when fun (let ((destroyed-constant-args (funcall fun args))) @@ -682,7 +691,7 @@ (dolist (arg args) (when arg (setf (lvar-reoptimize arg) nil))) - + (check-important-result node info) (let ((fun (fun-info-destroyed-constant-args info))) (when fun (let ((destroyed-constant-args (funcall fun args)))