[ruby-core:91738] [Ruby trunk Bug#15651] infinite loop in int_pow

From: shyouhei@...
Date: 2019-03-11 00:34:55 UTC
List: ruby-core #91738
Issue #15651 has been updated by shyouhei (Shyouhei Urabe).


```
zsh % gdb --args ./miniruby -ve '[1].repeated_permutation(1).size'
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./miniruby...done.
(gdb) run
Starting program: /home/shyouhei/data/build/ruby@gcc-8/trunk@git/miniruby -ve \[1\].repeated_permutation\(1\).size
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ruby 2.7.0dev (2019-03-05 trunk 67168) [x86_64-linux]
^C
Program received signal SIGINT, Interrupt.
int_pow (x=1, y=0) at /trunk/numeric.c:3999
3999                if (!FIT_SQRT_LONG(x)) {
(gdb) bt
#0  int_pow (x=1, y=0) at /trunk/numeric.c:3999
#1  0x000055555579000c in vm_call_cfunc_with_frame (ci=0x555555bd2c80, cc=<optimized out>, calling=0x555555ae68c0, reg_cfp=0x7ffff7fd3fa0, ec=0x555555ab54f8) at /trunk/vm_insnhelper.c:2006
#2  vm_call_cfunc () at /trunk/vm_insnhelper.c:2022
#3  0x0000555555794759 in vm_call_method_each_type.part () at /trunk/vm_insnhelper.c:2344
#4  0x0000555555794d12 in vm_call_method_each_type (cc=<optimized out>, ci=<optimized out>, calling=<optimized out>, cfp=<optimized out>, ec=<optimized out>) at /trunk/vm_insnhelper.c:2468
#5  vm_call_method (cc=<optimized out>, ci=<optimized out>, calling=<optimized out>, cfp=<optimized out>, ec=<optimized out>) at /trunk/vm_insnhelper.c:2496
#6  vm_call_method (ec=0x555555ab54f8, cfp=0x7ffff7fd3fa0, calling=<optimized out>, ci=<optimized out>, cc=<optimized out>) at /trunk/vm_insnhelper.c:2463
#7  0x000055555579b580 in vm_sendish (method_explorer=<optimized out>, block_handler=<optimized out>, cc=<optimized out>, ci=<optimized out>, reg_cfp=<optimized out>, ec=<optimized out>)
    at /trunk/vm_insnhelper.c:3350
#8  vm_exec_core () at ../../../src/trunk/insns.def:782
#9  0x00005555557929c6 in rb_vm_exec () at /trunk/vm.c:1897
#10 0x00005555557a40ea in rb_iseq_eval_main (iseq=<optimized out>) at /trunk/vm.c:2156
#11 0x00005555556087cf in ruby_exec_internal (n=0x555555ad6b00) at /trunk/eval.c:261
#12 0x000055555560c74b in ruby_exec_node (n=<optimized out>) at /trunk/eval.c:325
#13 ruby_run_node (n=<optimized out>) at /trunk/eval.c:317
#14 0x000055555557b0ef in main (argc=<optimized out>, argv=<optimized out>) at /trunk/main.c:42
(gdb)
```

----------------------------------------
Bug #15651: infinite loop in int_pow
https://bugs.ruby-lang.org/issues/15651#change-77014

* Author: pb (pumbur _)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
`[1].repeated_permutation(1).size` goes into infinite loop.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next