&REST with SAFETY 0: call to undefined function SB-C:%MORE-ARG-VALUES

Bug #826459 reported by Lutz Euler
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

(defun f (&rest rest)
  (declare (optimize (safety 0)))
  (apply #'cons rest))

(f 'car 'cdr)

debugger invoked on a UNDEFINED-FUNCTION in thread #<THREAD
                                                     "initial thread" RUNNING
                                                      {1002919711}>:
  The function SB-C:%MORE-ARG-VALUES is undefined.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

("bogus stack frame")
0]

(lisp-implementation-version)

"1.0.50.46-d5ec4e5"

This works OK without the SAFETY 0 declaration,
or, fwiw, with SAFETY 1.

This is a regression. It worked up to 1.0.48.24.
1.0.48.25 is the first broken version.
Start of the commit message:

1.0.48.25: automatic &rest to &more conversion

 lp#504575

 Automatically convert

   (values-list rest-arg)
 to
   (%more-arg-values more-context 0 more-count)

I found this while trying to build SBCL with a
PROCLAIM-TARGET-OPTIMIZATION of SAFETY 0
as this yields a faster compiler.
This crashes into ldb in warm init due to
the definition of BACKQ-CONS which has
much similarity to the reduced test case above:

//doing warm init - compilation phase
This is SBCL 1.0.50.46.safety0.1, an implementation of ANSI
Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
internal error #23 (An attempt was made to use an undefined FDEFINITION.)
    SC: 21, Offset: 0 $1= 0x10000806ef: other pointer
fatal error encountered in SBCL pid 11098(tid 140737353930528):
internal error too early in init, can't recover

Welcome to LDB, a low-level debugger for the Lisp runtime environment.
ldb> backtrace
Backtrace:
   0: Foreign function lose, fp = 0x7ffff6d47640, ra = 0x40f788
   1: Foreign function interrupt_internal_error, fp = 0x7ffff6d47710,
        ra = 0x412a58
   2: Foreign function handle_trap, fp = 0x7ffff6d477e0, ra = 0x415770
   3: Foreign function (null), fp = 0x7ffff6d478b0, ra = 0x410401
   4: Foreign function (null), fp = 0x7ffff6d47d30, ra = 0x7ffff79c9c60
   5: (SB!C::&MORE-PROCESSOR SB!IMPL::BACKQ-CONS)
   6: SB!KERNEL::INITIAL-HANDLER-CLUSTERS
   7: (SB!C::TOP-LEVEL-FORM ())
   8: SB!KERNEL::!COLD-INIT
ldb> print 0x10000806ef
$1= 0x10000806ef: other pointer
     header: 0x0000035e: fdefn
$2= name: 0x100001f0ff: %MORE-ARG-VALUES
$nil= function: 0x20100017: NIL
     raw_addr: 0x00425020: 1086472
ldb>

Sorry, I have no fix.

Kind regards,

Lutz

Tags: regression
Lutz Euler (lutz-euler)
tags: added: regression
Paul Khuong (pvk)
Changed in sbcl:
importance: Undecided → Medium
status: New → In Progress
assignee: nobody → Paul Khuong (pvk)
Revision history for this message
Paul Khuong (pvk) wrote :

Fixed in 86d50ba Fix automatic &rest to &more conversion in unsafe code.

Thanks for the tiny test case!

Changed in sbcl:
status: In Progress → Fix Committed
assignee: Paul Khuong (pvk) → nobody
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.