Re: Another spurious compilation diagnostic?

Madhu <[email protected]>
Newsgroups gmane.lisp.cmucl.general
Organization Motzarella
Message-ID <[email protected]>
       [pardon the top post, if you find it inappropriate]

The CLHS entry for LIST-LENGTH says:

,----
| Returns the length of list if list is a proper list. Returns nil if
| list is a circular list.
`----

This means one of the possible return values is NIL.  The compiler
diagnostics seem to indicate that it has inferred that the value
returned by LIST-LENGTH are used only in number contexts.

The compiler is warning you that there will be an error in the event
LIST-LENGTH returns NIL.

I suspect the case with the other diagnostic is similar. It is likely
you are using the return value of a (WHEN clause) where the compiler
always expects a number.

Both of these deal with the specifics of your code , so it is likely
the compiler knows better (as it has access to the code) than us (who
dont:)

* Steven Edwards <[email protected]> :
Wrote on Mon, 22 Sep 2008 22:57:40 -0400:

| This might help:
|
| The problem occurs when the (list-length foobar) expression appears as
| the right hand side of a variable binding in a let* list.
|
| A perhaps related spurious diagnostic also appears in the same let*
| context (but in different lets):
|
| ;   (WHEN INLINE-FLAG
| ;     (FETCH-DIR PAS-KING-SQ FR-SQ))
| ; --> COND IF
| ; ==>
| ;   (COND)
| ; Warning: This is not a (VALUES &OPTIONAL (MOD 536870911) &REST T):
| ;   NIL
| ; ; [Last message occurs 2 times]
|
| The above COND IF NIL stuff must be from a cmucl macro expansion as
| it's not in the user source.
|
| I note that the resulting compiled object code for all of the spurious
| warning cases runs fine as does the interpreted code version.  Same
| for the clisp and gcl processors.
|
| == Steven
|
|
| On Sep 22, 2008, at 7:58 PM, Raymond Toy wrote:
|
|> Steven Edwards wrote:
|>> Greetings again, list readers:
|>>
|>> It seems that every time I compile something like:
|>>
|>>  (list-length some-random-list)
|>>
|>> I get a compiler warning:
|>>
|>> ;   (LIST-LENGTH SOME-RANDOM-LIST)
|>> ; --> BLOCK DO BLOCK LET TAGBODY WHEN COND IF PROGN RETURN
|>> ; ==>
|>> ;   (RETURN-FROM NIL NIL)
|>> ; Warning: This is not a (VALUES &OPTIONAL REAL &REST T):
|>> ;   NIL
|>> ; ; [Last message occurs 2 times]
|>>
|>> Any ideas?
|>>
|> I can't reproduce this.  What version of cmucl?  Can you provide a
|> complete example that shows this?
|>
|> Thanks,
|>
|> Ray
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.