1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Provide backtrace for byte-ops aref and aset

Produce synthetic backtrace entries for `aref` and `aset` byte-ops
when the index is non-fixnum, or is out of range for vector or record
arguments (bug#64613).

* src/bytecode.c (exec_byte_code): Detect type and range errors
in-line for aref and aset.
* src/data.c (syms_of_data): Declare symbols Qaref and Qaset.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--byte-op-error-cases): Add test cases.
This commit is contained in:
Mattias Engdegård 2023-07-25 12:16:30 +02:00
parent c50f6538cf
commit 82f5f3b8a2
3 changed files with 46 additions and 15 deletions

View file

@ -1953,6 +1953,15 @@ EXPECTED-POINT BINDINGS (MODES \\='\\='(ruby-mode js-mode python-mode)) \
((setcdr c 5) (wrong-type-argument consp c))
((nth 2 "abcd") (wrong-type-argument listp "abcd"))
((elt (x y . z) 2) (wrong-type-argument listp z))
((aref [2 3 5] p) (wrong-type-argument fixnump p))
((aref #s(a b c) p) (wrong-type-argument fixnump p))
((aref "abc" p) (wrong-type-argument fixnump p))
((aref [2 3 5] 3) (args-out-of-range [2 3 5] 3))
((aref #s(a b c) 3) (args-out-of-range #s(a b c) 3))
((aset [2 3 5] q 1) (wrong-type-argument fixnump q))
((aset #s(a b c) q 1) (wrong-type-argument fixnump q))
((aset [2 3 5] -1 1) (args-out-of-range [2 3 5] -1))
((aset #s(a b c) -1 1) (args-out-of-range #s(a b c) -1))
;; Many more to add
))