Ticket #887 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

COMPILER-WARNING-SOURCE-NOTEs when not saving source locations

Reported by: gb Owned by:
Priority: normal Milestone:
Component: Compiler Version: trunk
Keywords: Cc:

Description

Given:

$ cat warning.lisp
xyz    ;;; e.g., a reference to a non-special free variable

;;; EOF
$

we can get:

? (compile-file "foo.lisp" :save-source-locations nil)
> Error: value NIL is not of the expected type NUMBER.
> While executing: --2, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.

The error comes from code which tries to ensure that the COMPILER-WARNING will have an associated SOURCE-NOTE (presumably since if it didn't, the COMPILER-WARNING wouldn't have an associated SOURCE-NOTE ...) The SOURCE-NOTE's start-pos and end-pos are initialized to the value of *FCOMP-STREAM-POSITION*, which is NIL by the time this warning is signaled.

 (7FDCCEF42138) : 0 (--2 NIL NIL) 5245
 (7FDCCEF42170) : 1 (ENCODE-FILE-RANGE NIL NIL) 69
 (7FDCCEF42190) : 2 (MAKE-SOURCE-NOTE :FILENAME "home:warning.lisp.newest" :START-POS NIL :END-POS NIL :SOURCE NIL) 101
 (7FDCCEF421F8) : 3 (FCOMP-SIGNAL-OR-DEFER-WARNINGS (#<COMPILER-WARNING #x30200279B3ED>) #<LEXICAL-ENVIRONMENT #x30200279B67D>) 333
 (7FDCCEF42250) : 4 (FCOMP-NAMED-FUNCTION (LAMBDA NIL (PROGN XYZ)) NIL #<LEXICAL-ENVIRONMENT #x30200279CD9D> NIL) 597
 (7FDCCEF422C0) : 5 (FCOMP-COMPILE-TOPLEVEL-FORMS #<LEXICAL-ENVIRONMENT #x30200279CD9D>) 693

Change History

comment:1 Changed 3 years ago by gz

  • Status changed from new to closed
  • Resolution set to fixed

(In [15013]) Only store *fcomp-stream-position* in compiler warnings if it's non-nil, make merge-compiler-warnings deal with the nil case. Fixes ticket:887.

Note: See TracTickets for help on using tickets.