* [ruby-core:102061] [Ruby master Bug#17534] Pattern-matching is broken with find pattern
@ 2021-01-13 14:46 zverok.offline
2021-01-18 7:18 ` [ruby-core:102131] " dementiev.vm
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: zverok.offline @ 2021-01-13 14:46 UTC (permalink / raw)
To: ruby-core
Issue #17534 has been reported by zverok (Victor Shepelev).
----------------------------------------
Bug #17534: Pattern-matching is broken with find pattern
https://bugs.ruby-lang.org/issues/17534
* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
The minimal reproduction code:
```ruby
case [1, 2, 3]
in y
puts "branch1"
in [*, x, *]
puts "branch2"
else
puts "branch3"
end
```
This outputs long "raw disasm" sequence, and then
```
---------------------
break_pm.rb:6: argument stack underflow (-1)
break_pm.rb: compile error (SyntaxError)
```
```
$ ruby -v
ruby 3.1.0dev (2021-01-13T09:12:49Z master 6f6dfdcc68) [x86_64-linux]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:102131] [Ruby master Bug#17534] Pattern-matching is broken with find pattern
2021-01-13 14:46 [ruby-core:102061] [Ruby master Bug#17534] Pattern-matching is broken with find pattern zverok.offline
@ 2021-01-18 7:18 ` dementiev.vm
2021-01-18 16:59 ` [ruby-core:102140] " dementiev.vm
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dementiev.vm @ 2021-01-18 7:18 UTC (permalink / raw)
To: ruby-core
Issue #17534 has been updated by palkan (Vladimir Dementyev).
zverok (Victor Shepelev) wrote:
> The minimal reproduction code:
>
> ```ruby
> case [1, 2, 3]
> in y
> puts "branch1"
> in [*, x, *]
> puts "branch2"
> else
> puts "branch3"
> end
> ```
> This outputs long "raw disasm" sequence, and then
> ```
> ---------------------
> break_pm.rb:6: argument stack underflow (-1)
> break_pm.rb: compile error (SyntaxError)
> ```
>
> ```
> $ ruby -v
> ruby 3.1.0dev (2021-01-13T09:12:49Z master 6f6dfdcc68) [x86_64-linux]
> ```
That could be related to https://github.com/ruby/ruby/pull/3104.
I'll take a look.
----------------------------------------
Bug #17534: Pattern-matching is broken with find pattern
https://bugs.ruby-lang.org/issues/17534#change-89985
* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
The minimal reproduction code:
```ruby
case [1, 2, 3]
in y
puts "branch1"
in [*, x, *]
puts "branch2"
else
puts "branch3"
end
```
This outputs long "raw disasm" sequence, and then
```
---------------------
break_pm.rb:6: argument stack underflow (-1)
break_pm.rb: compile error (SyntaxError)
```
```
$ ruby -v
ruby 3.1.0dev (2021-01-13T09:12:49Z master 6f6dfdcc68) [x86_64-linux]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:102140] [Ruby master Bug#17534] Pattern-matching is broken with find pattern
2021-01-13 14:46 [ruby-core:102061] [Ruby master Bug#17534] Pattern-matching is broken with find pattern zverok.offline
2021-01-18 7:18 ` [ruby-core:102131] " dementiev.vm
@ 2021-01-18 16:59 ` dementiev.vm
2021-01-18 20:32 ` [ruby-core:102144] " dementiev.vm
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dementiev.vm @ 2021-01-18 16:59 UTC (permalink / raw)
To: ruby-core
Issue #17534 has been updated by palkan (Vladimir Dementyev).
palkan (Vladimir Dementyev) wrote in #note-1:
> That could be related to https://github.com/ruby/ruby/pull/3104.
> I'll take a look.
Hm, nope. Reproduced in the older revision (`d6c9c014e2`). Investigating further.
----------------------------------------
Bug #17534: Pattern-matching is broken with find pattern
https://bugs.ruby-lang.org/issues/17534#change-89991
* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
The minimal reproduction code:
```ruby
case [1, 2, 3]
in y
puts "branch1"
in [*, x, *]
puts "branch2"
else
puts "branch3"
end
```
This outputs long "raw disasm" sequence, and then
```
---------------------
break_pm.rb:6: argument stack underflow (-1)
break_pm.rb: compile error (SyntaxError)
```
```
$ ruby -v
ruby 3.1.0dev (2021-01-13T09:12:49Z master 6f6dfdcc68) [x86_64-linux]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:102144] [Ruby master Bug#17534] Pattern-matching is broken with find pattern
2021-01-13 14:46 [ruby-core:102061] [Ruby master Bug#17534] Pattern-matching is broken with find pattern zverok.offline
2021-01-18 7:18 ` [ruby-core:102131] " dementiev.vm
2021-01-18 16:59 ` [ruby-core:102140] " dementiev.vm
@ 2021-01-18 20:32 ` dementiev.vm
2021-01-18 21:27 ` [ruby-core:102145] " dementiev.vm
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dementiev.vm @ 2021-01-18 20:32 UTC (permalink / raw)
To: ruby-core
Issue #17534 has been updated by palkan (Vladimir Dementyev).
So, what I found: the bug is caused by `iseq_peephole_optimize` and find patterns iseq incompatibility; `remove_unreachable_chunk` doesn't remove `while_begin`, `next_loop` and other find_pattern specific labels, but removes general pattern matching instructions (including stack allocation for "local" variables). (Disabling `remove_unreachable_chunk` fixes this).
Possibly, that happens due to the labels cycle (`while_begin` -> `next_loop` -> `while_begin`); though I'm not really familiar with the _peephole optimization_. /cc @nobu @ko1
----------------------------------------
Bug #17534: Pattern-matching is broken with find pattern
https://bugs.ruby-lang.org/issues/17534#change-89995
* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
The minimal reproduction code:
```ruby
case [1, 2, 3]
in y
puts "branch1"
in [*, x, *]
puts "branch2"
else
puts "branch3"
end
```
This outputs long "raw disasm" sequence, and then
```
---------------------
break_pm.rb:6: argument stack underflow (-1)
break_pm.rb: compile error (SyntaxError)
```
```
$ ruby -v
ruby 3.1.0dev (2021-01-13T09:12:49Z master 6f6dfdcc68) [x86_64-linux]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:102145] [Ruby master Bug#17534] Pattern-matching is broken with find pattern
2021-01-13 14:46 [ruby-core:102061] [Ruby master Bug#17534] Pattern-matching is broken with find pattern zverok.offline
` (2 preceding siblings ...)
2021-01-18 20:32 ` [ruby-core:102144] " dementiev.vm
@ 2021-01-18 21:27 ` dementiev.vm
2021-01-23 12:31 ` [ruby-core:102218] " kazuki
2021-02-02 10:08 ` [ruby-core:102381] " naruse
5 siblings, 0 replies; 7+ messages in thread
From: dementiev.vm @ 2021-01-18 21:27 UTC (permalink / raw)
To: ruby-core
Issue #17534 has been updated by palkan (Vladimir Dementyev).
As a quick fix I propose marking patterns as unremoveable: https://github.com/ruby/ruby/pull/4094
----------------------------------------
Bug #17534: Pattern-matching is broken with find pattern
https://bugs.ruby-lang.org/issues/17534#change-89996
* Author: zverok (Victor Shepelev)
* Status: Open
* Priority: Normal
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
The minimal reproduction code:
```ruby
case [1, 2, 3]
in y
puts "branch1"
in [*, x, *]
puts "branch2"
else
puts "branch3"
end
```
This outputs long "raw disasm" sequence, and then
```
---------------------
break_pm.rb:6: argument stack underflow (-1)
break_pm.rb: compile error (SyntaxError)
```
```
$ ruby -v
ruby 3.1.0dev (2021-01-13T09:12:49Z master 6f6dfdcc68) [x86_64-linux]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:102218] [Ruby master Bug#17534] Pattern-matching is broken with find pattern
2021-01-13 14:46 [ruby-core:102061] [Ruby master Bug#17534] Pattern-matching is broken with find pattern zverok.offline
` (3 preceding siblings ...)
2021-01-18 21:27 ` [ruby-core:102145] " dementiev.vm
@ 2021-01-23 12:31 ` kazuki
2021-02-02 10:08 ` [ruby-core:102381] " naruse
5 siblings, 0 replies; 7+ messages in thread
From: kazuki @ 2021-01-23 12:31 UTC (permalink / raw)
To: ruby-core
Issue #17534 has been updated by ktsj (Kazuki Tsujimoto).
Backport changed from 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONTNEED, 3.0: REQUIRED
Status changed from Open to Closed
@palkan:
Thanks to fix!
@naruse:
Could you backport 1b89b99941548fdb65305dd9a412082e7fdba45a to 3.0?
----------------------------------------
Bug #17534: Pattern-matching is broken with find pattern
https://bugs.ruby-lang.org/issues/17534#change-90065
* Author: zverok (Victor Shepelev)
* Status: Closed
* Priority: Normal
* Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONTNEED, 3.0: REQUIRED
----------------------------------------
The minimal reproduction code:
```ruby
case [1, 2, 3]
in y
puts "branch1"
in [*, x, *]
puts "branch2"
else
puts "branch3"
end
```
This outputs long "raw disasm" sequence, and then
```
---------------------
break_pm.rb:6: argument stack underflow (-1)
break_pm.rb: compile error (SyntaxError)
```
```
$ ruby -v
ruby 3.1.0dev (2021-01-13T09:12:49Z master 6f6dfdcc68) [x86_64-linux]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
* [ruby-core:102381] [Ruby master Bug#17534] Pattern-matching is broken with find pattern
2021-01-13 14:46 [ruby-core:102061] [Ruby master Bug#17534] Pattern-matching is broken with find pattern zverok.offline
` (4 preceding siblings ...)
2021-01-23 12:31 ` [ruby-core:102218] " kazuki
@ 2021-02-02 10:08 ` naruse
5 siblings, 0 replies; 7+ messages in thread
From: naruse @ 2021-02-02 10:08 UTC (permalink / raw)
To: ruby-core
Issue #17534 has been updated by naruse (Yui NARUSE).
Backport changed from 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONTNEED, 3.0: REQUIRED to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONE
ruby_3_0 2dc39e2fd45aacd5fcd33ed80f602bd6f2ddb504 merged revision(s) 1b89b99941548fdb65305dd9a412082e7fdba45a.
----------------------------------------
Bug #17534: Pattern-matching is broken with find pattern
https://bugs.ruby-lang.org/issues/17534#change-90242
* Author: zverok (Victor Shepelev)
* Status: Closed
* Priority: Normal
* Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONE
----------------------------------------
The minimal reproduction code:
```ruby
case [1, 2, 3]
in y
puts "branch1"
in [*, x, *]
puts "branch2"
else
puts "branch3"
end
```
This outputs long "raw disasm" sequence, and then
```
---------------------
break_pm.rb:6: argument stack underflow (-1)
break_pm.rb: compile error (SyntaxError)
```
```
$ ruby -v
ruby 3.1.0dev (2021-01-13T09:12:49Z master 6f6dfdcc68) [x86_64-linux]
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-02-02 10:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-13 14:46 [ruby-core:102061] [Ruby master Bug#17534] Pattern-matching is broken with find pattern zverok.offline
2021-01-18 7:18 ` [ruby-core:102131] " dementiev.vm
2021-01-18 16:59 ` [ruby-core:102140] " dementiev.vm
2021-01-18 20:32 ` [ruby-core:102144] " dementiev.vm
2021-01-18 21:27 ` [ruby-core:102145] " dementiev.vm
2021-01-23 12:31 ` [ruby-core:102218] " kazuki
2021-02-02 10:08 ` [ruby-core:102381] " naruse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).