Actions
Bug #21460
openPattern matching crash: unexpected PM_CALL_NODE
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.5.0dev (2025-06-11 commit 970813d982) +PRISM
Description
Hi,
Pattern matching crashes when using an arithmetic expression like -1**2
in a hash pattern. Ruby attempts to process the expression as a PM_CALL_NODE, which results in a compiler crash rather than a syntax or match error.
Input¶
foo => -1**2
Output¶
input.rb: [BUG] Unexpected node type in pattern matching expression: PM_CALL_NODE
ruby 3.5.0dev (2025-06-11T18:07:43Z master 970813d982) +PRISM [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0001 p:0000 s:0003 E:000720 DUMMY [FINISH]
-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1
-- C level backtrace information -------------------------------------------
/lib/x86_64-linux-gnu/libasan.so.5(__interceptor_backtrace+0x40) [0x7f0716ea0d40] ../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:4022
/home/program/build/ruby(rb_print_backtrace+0x11) [0x55d00b05dda9] ../vm_dump.c:843
/home/program/build/ruby(rb_vm_bugreport) ../vm_dump.c:1175
/home/program/build/ruby(rb_bug_without_die_internal+0xc5) [0x55d00a720b21] ../error.c:1097
/home/program/build/ruby(rb_bug) ../error.c:1115
/home/program/build/ruby(pm_compile_pattern+0x3e76) [0x55d00aee1b46] ../prism_compile.c:3171
/home/program/build/ruby(ADD_ELEM+0x0) [0x55d00aeb2793] ../prism_compile.c:8125
/home/program/build/ruby(pm_compile_match_required_node) ../prism_compile.c:8130
/home/program/build/ruby(pm_compile_node) ../prism_compile.c:9847
/home/program/build/ruby(pm_compile_node+0x529d) [0x55d00aea7bdd] ../prism_compile.c:10330
/home/program/build/ruby(pm_compile_scope_node+0x3f42) [0x55d00aeff382] ../prism_compile.c:7012
/home/program/build/ruby(pm_compile_node+0x1b50) [0x55d00aea4490] ../prism_compile.c:10201
/home/program/build/ruby(APPEND_LIST+0x0) [0x55d00af062a4] ../prism_compile.c:10502
/home/program/build/ruby(pm_iseq_compile_node) ../prism_compile.c:10506
/home/program/build/ruby(pm_iseq_new_with_opt_try+0x3e) [0x55d00a840c5e] ../iseq.c:1050
/home/program/build/ruby(rb_protect+0x30f) [0x55d00a7343ff] ../eval.c:1059
/home/program/build/ruby(pm_iseq_new_with_opt+0x482) [0x55d00a84ec12] ../iseq.c:1103
/home/program/build/ruby(pm_iseq_new_main+0xbc) [0x55d00a84f2ac] ../iseq.c:951
/home/program/build/ruby(process_options+0x2d32) [0x55d00a9eeb12] ../ruby.c:2641
/home/program/build/ruby(ruby_process_options+0x3f0) [0x55d00a9f1290] ../ruby.c:3199
/home/program/build/ruby(ruby_options+0x2a7) [0x55d00a731407] ../eval.c:117
/home/program/build/ruby(rb_main+0x19) [0x55d00a7227ff] ../main.c:42
/home/program/build/ruby(main) ../main.c:62
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f07169ec083]
/home/program/build/ruby(_start) [0x55d00a723dce]
-- Other runtime information -----------------------------------------------
* Loaded script: input.rb
* Loaded features:
0 enumerator.so
1 thread.rb
2 fiber.so
3 rational.so
4 complex.so
5 ruby2_keywords.rb
6 set.rb
Aborted
Environment¶
Ruby version: ruby 3.5.0dev (2025-06-11 commit 970813d982) +PRISM
Platform: x86_64-linux
Built from source
Parser backend: Prism (default)
Updated by bendrissou (Bachir Bendrissou) about 10 hours ago
ยท Edited
- Subject changed from Pattern matching crash: unexpected `PM_CALL_NODE` to Pattern matching crash: unexpected PM_CALL_NODE
Actions
Like0
Like0