ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120531] [Ruby master Bug#21012] Compiling `a['a','b'],=1` with parse.y fails
@ 2025-01-07 18:43 tompng (tomoya ishida) via ruby-core
  2025-01-07 20:15 ` [ruby-core:120535] " jeremyevans0 (Jeremy Evans) via ruby-core
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: tompng (tomoya ishida) via ruby-core @ 2025-01-07 18:43 UTC (permalink / raw)
  To: ruby-core; +Cc: tompng (tomoya ishida)

Issue #21012 has been reported by tompng (tomoya ishida).

----------------------------------------
Bug #21012: Compiling `a['a','b'],=1` with parse.y fails
https://bugs.ruby-lang.org/issues/21012

* Author: tompng (tomoya ishida)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-01-06T01:50:53Z master c8e3d745fa) [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Compiling this code with parse.y fails with segmentation fault.
~~~ruby
a['a','b'],=1
~~~

Compiling `a['a',x],=1` generates instruction sequence that wrong contains `opt_aset_with`.

~~~
$ ruby --parser=parse.y --dump=insn -e "a['a',999],=1"
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)>
0000 putself                                                          (   1)[Li]
0001 opt_send_without_block                 <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 putobject_INT2FIX_1_
0004 dup
0005 expandarray                            1, 0
0008 topn                                   1001
....
2006 topn                                   1001
2008 topn                                   1000
2010 opt_aset_with                          "a", <calldata!mid:[]=, argc:2, ARGS_SIMPLE>
2013 setn                                   1000
2015 pop
....
3014 pop
3015 leave
~~~





-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:120535] [Ruby master Bug#21012] Compiling `a['a','b'],=1` with parse.y fails
  2025-01-07 18:43 [ruby-core:120531] [Ruby master Bug#21012] Compiling `a['a','b'],=1` with parse.y fails tompng (tomoya ishida) via ruby-core
@ 2025-01-07 20:15 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2025-01-08  1:38 ` [ruby-core:120543] " jeremyevans0 (Jeremy Evans) via ruby-core
  2025-01-15  1:56 ` [ruby-core:120688] " k0kubun (Takashi Kokubun) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2025-01-07 20:15 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #21012 has been updated by jeremyevans0 (Jeremy Evans).

Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED

>From testing some historical versions on my system:

For: `a['a','b'],=1`

* Ruby 1.9-2.5: No segfault, looks to be correct instructions
* Ruby 2.6-3.1: Segfault
* Ruby 3.2: No segfault, but incorrect instructions
* Ruby 3.3-3.4: Segfault

For: `a['a',10],=1`:

* Ruby 1.9-2.5: No segfault, looks to be correct instructions
* Ruby 2.6-3.1: Segfault
* Ruby 3.2-3.4: No segfault, but incorrect instructions



----------------------------------------
Bug #21012: Compiling `a['a','b'],=1` with parse.y fails
https://bugs.ruby-lang.org/issues/21012#change-111337

* Author: tompng (tomoya ishida)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-01-06T01:50:53Z master c8e3d745fa) [x86_64-linux]
* Backport: 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED
----------------------------------------
Compiling this code with parse.y fails with segmentation fault.
~~~ruby
a['a','b'],=1
~~~

Compiling `a['a',x],=1` generates instruction sequence that wrong contains `opt_aset_with`.

~~~
$ ruby --parser=parse.y --dump=insn -e "a['a',999],=1"
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)>
0000 putself                                                          (   1)[Li]
0001 opt_send_without_block                 <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 putobject_INT2FIX_1_
0004 dup
0005 expandarray                            1, 0
0008 topn                                   1001
....
2006 topn                                   1001
2008 topn                                   1000
2010 opt_aset_with                          "a", <calldata!mid:[]=, argc:2, ARGS_SIMPLE>
2013 setn                                   1000
2015 pop
....
3014 pop
3015 leave
~~~





-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:120543] [Ruby master Bug#21012] Compiling `a['a','b'],=1` with parse.y fails
  2025-01-07 18:43 [ruby-core:120531] [Ruby master Bug#21012] Compiling `a['a','b'],=1` with parse.y fails tompng (tomoya ishida) via ruby-core
  2025-01-07 20:15 ` [ruby-core:120535] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2025-01-08  1:38 ` jeremyevans0 (Jeremy Evans) via ruby-core
  2025-01-15  1:56 ` [ruby-core:120688] " k0kubun (Takashi Kokubun) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: jeremyevans0 (Jeremy Evans) via ruby-core @ 2025-01-08  1:38 UTC (permalink / raw)
  To: ruby-core; +Cc: jeremyevans0 (Jeremy Evans)

Issue #21012 has been updated by jeremyevans0 (Jeremy Evans).


I've submitted a PR that should fix this: https://github.com/ruby/ruby/pull/12528

----------------------------------------
Bug #21012: Compiling `a['a','b'],=1` with parse.y fails
https://bugs.ruby-lang.org/issues/21012#change-111347

* Author: tompng (tomoya ishida)
* Status: Open
* ruby -v: ruby 3.5.0dev (2025-01-06T01:50:53Z master c8e3d745fa) [x86_64-linux]
* Backport: 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED
----------------------------------------
Compiling this code with parse.y fails with segmentation fault.
~~~ruby
a['a','b'],=1
~~~

Compiling `a['a',x],=1` generates instruction sequence that wrong contains `opt_aset_with`.

~~~
$ ruby --parser=parse.y --dump=insn -e "a['a',999],=1"
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)>
0000 putself                                                          (   1)[Li]
0001 opt_send_without_block                 <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 putobject_INT2FIX_1_
0004 dup
0005 expandarray                            1, 0
0008 topn                                   1001
....
2006 topn                                   1001
2008 topn                                   1000
2010 opt_aset_with                          "a", <calldata!mid:[]=, argc:2, ARGS_SIMPLE>
2013 setn                                   1000
2015 pop
....
3014 pop
3015 leave
~~~





-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:120688] [Ruby master Bug#21012] Compiling `a['a','b'],=1` with parse.y fails
  2025-01-07 18:43 [ruby-core:120531] [Ruby master Bug#21012] Compiling `a['a','b'],=1` with parse.y fails tompng (tomoya ishida) via ruby-core
  2025-01-07 20:15 ` [ruby-core:120535] " jeremyevans0 (Jeremy Evans) via ruby-core
  2025-01-08  1:38 ` [ruby-core:120543] " jeremyevans0 (Jeremy Evans) via ruby-core
@ 2025-01-15  1:56 ` k0kubun (Takashi Kokubun) via ruby-core
  2 siblings, 0 replies; 4+ messages in thread
From: k0kubun (Takashi Kokubun) via ruby-core @ 2025-01-15  1:56 UTC (permalink / raw)
  To: ruby-core; +Cc: k0kubun (Takashi Kokubun)

Issue #21012 has been updated by k0kubun (Takashi Kokubun).

Backport changed from 3.1: REQUIRED, 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED to 3.1: REQUIRED, 3.2: REQUIRED, 3.3: DONE, 3.4: REQUIRED

ruby_3_3 commit:3a986b47cba80bdc081638d5f759a26c1beb8fad merged revision(s) commit:e0d600ec190c64aff76cfcbd6009cffb927da166.

----------------------------------------
Bug #21012: Compiling `a['a','b'],=1` with parse.y fails
https://bugs.ruby-lang.org/issues/21012#change-111511

* Author: tompng (tomoya ishida)
* Status: Closed
* ruby -v: ruby 3.5.0dev (2025-01-06T01:50:53Z master c8e3d745fa) [x86_64-linux]
* Backport: 3.1: REQUIRED, 3.2: REQUIRED, 3.3: DONE, 3.4: REQUIRED
----------------------------------------
Compiling this code with parse.y fails with segmentation fault.
~~~ruby
a['a','b'],=1
~~~

Compiling `a['a',x],=1` generates instruction sequence that wrong contains `opt_aset_with`.

~~~
$ ruby --parser=parse.y --dump=insn -e "a['a',999],=1"
== disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)>
0000 putself                                                          (   1)[Li]
0001 opt_send_without_block                 <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0003 putobject_INT2FIX_1_
0004 dup
0005 expandarray                            1, 0
0008 topn                                   1001
....
2006 topn                                   1001
2008 topn                                   1000
2010 opt_aset_with                          "a", <calldata!mid:[]=, argc:2, ARGS_SIMPLE>
2013 setn                                   1000
2015 pop
....
3014 pop
3015 leave
~~~





-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-15  1:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-07 18:43 [ruby-core:120531] [Ruby master Bug#21012] Compiling `a['a','b'],=1` with parse.y fails tompng (tomoya ishida) via ruby-core
2025-01-07 20:15 ` [ruby-core:120535] " jeremyevans0 (Jeremy Evans) via ruby-core
2025-01-08  1:38 ` [ruby-core:120543] " jeremyevans0 (Jeremy Evans) via ruby-core
2025-01-15  1:56 ` [ruby-core:120688] " k0kubun (Takashi Kokubun) via ruby-core

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 NNTP newsgroup(s).