Re: SBCL tells me it is deleting unreachable code that is almost surely reachable

Raymond Toy <[email protected]>
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <[email protected]>
On 4/15/26 8:25 AM, Barton Willis via Maxima-discuss wrote:

> Here is a revision of a function in hayat. The revision eliminates or 
> helps to eliminate two testsuite failures.
>
> The SBCL (2.4.7)  compiler tells me that
>
> ; file: C:/Users/barton/maxima-code-pure/maxima-code/src/./hayat.lisp
> ; in: DEFUN COEF-SIGN
> ;     (EQ MAXIMA::SGN 'MAXIMA::$POS)
> ;
> ; note: deleting unreachable code
>
> I think that is rubbish—likely, I'll commit the (commented out) memq 
> version.

Check to see what |$csign| returns? Or rather what csign-impl returns. 
For me, I see the return type is * (anything).

|memq| should do exactly the same as testing |(or (eq sgn '$neg) (eq sgn 
'$zero) (eq sgn '$pos))|. Well, it would if it were declared inline, but 
it’s not.

Seems to me that it would be easy to test if that code were actually 
deleted by calling |coef-sign| with an arg that is known to be |$pos|.

>
> (defun coef-sign (coef)
>   (let ((sgn ($csign coef)))
>     (cond ((or (eq sgn '$complex) (eq sgn '$imaginary)) '$im)
>           ;((memq sgn '($neg '$zero '$pos)) sgn)
>           ((or (eq sgn '$neg) (eq sgn '$zero) (eq sgn '$pos)) sgn)
>           (t
>              (let ((asgn ($asksign coef)))
>                 ;; When sgn is zero and limit is active, record this 
> fact as a noun equality
>                 ;; in *limit-assumptions*.
>              (when (and *limit-assumptions* (eq asgn '$zero))
>                (push (ftake '$equal coef 0) *limit-assumptions*))
>             asgn)))))
>
>
>
> _______________________________________________
> Maxima-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/maxima-discuss
&#8203;

_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.