ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120147] [Ruby master Bug#20939] When using the parse.y parser, it occurs argument stack underflow (-1) if there is processing after the shareable_constant_value: experimental_everything comment and `C = { **{ k: v } }`
@ 2024-12-10  4:56 ydah (Yudai Takada) via ruby-core
  2024-12-13 15:58 ` [ruby-core:120231] " tompng (tomoya ishida) via ruby-core
  2024-12-26 12:02 ` [ruby-core:120418] " ydah (Yudai Takada) via ruby-core
  0 siblings, 2 replies; 3+ messages in thread
From: ydah (Yudai Takada) via ruby-core @ 2024-12-10  4:56 UTC (permalink / raw)
  To: ruby-core; +Cc: ydah (Yudai Takada)

Issue #20939 has been reported by ydah (Yudai Takada).

----------------------------------------
Bug #20939: When using the parse.y parser, it occurs argument stack underflow (-1) if there is processing after the shareable_constant_value: experimental_everything comment and `C = { **{ k: v } }`
https://bugs.ruby-lang.org/issues/20939

* Author: ydah (Yudai Takada)
* Status: Open
* ruby -v: ruby 3.4.0dev (2024-12-10T03:31:47Z master f12e2622c1) [arm64-darwin23]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following code will occurs argument stack underflow if it is a parse.y parser.

```ruby
# shareable_constant_value: experimental_everything
C = { **{ k: v } }
p C
```
The following error message is output.

```
ruby 3.4.0dev (2024-12-06T03:32:20Z master 6ccaa37eb3) [arm64-darwin23]
-- raw disasm--------
   trace: 1
   0000 putspecialobject     1                                           (   2)
   0002 putobject            :k                                          (   2)
   0004 putself                                                          (   2)
   0005 opt_send_without_block <calldata:v, 0>                           (   2)
   0007 newhash              2                                           (   2)
   0009 newhash              2                                           (   2)
   0011 opt_send_without_block <calldata:make_shareable, 1>              (   2)
   0013 putspecialobject     3                                           (   2)
*  0015 setconstant          :C                                          (   2)
   trace: 1
   0017 putself                                                          (   3)
   0018 opt_getconstant_path [:C]                                        (   3)
   0020 opt_send_without_block <calldata:p, 1>                           (   3)
   0022 leave                                                            (   3)
---------------------
-e:2: argument stack underflow (-1)
-e: compile error (SyntaxError)
```

It does not occur in the following cases:

```ruby
# shareable_constant_value: experimental_everything
C = { **{ k: v } }
```

```ruby
C = { **{ k: v } }                           
p C
```

```ruby
# shareable_constant_value: experimental_everything
{ **{ k: v } }
p C
```

```ruby
# shareable_constant_value: experimental_everything
C = { **{ k: 1 } }
p C
```

This does not occur in Ruby 3.3:
```
❯ ruby --parser=parse.y -v -e '# shareable_constant_value: experimental_everything

C = { **{ foo: bar } }

p C'
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin23]
-e:3:in `<main>': undefined local variable or method `bar' for main (NameError)

C = { **{ foo: bar } }
               ^^^
```



-- 
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] 3+ messages in thread

* [ruby-core:120231] [Ruby master Bug#20939] When using the parse.y parser, it occurs argument stack underflow (-1) if there is processing after the shareable_constant_value: experimental_everything comment and `C = { **{ k: v } }`
  2024-12-10  4:56 [ruby-core:120147] [Ruby master Bug#20939] When using the parse.y parser, it occurs argument stack underflow (-1) if there is processing after the shareable_constant_value: experimental_everything comment and `C = { **{ k: v } }` ydah (Yudai Takada) via ruby-core
@ 2024-12-13 15:58 ` tompng (tomoya ishida) via ruby-core
  2024-12-26 12:02 ` [ruby-core:120418] " ydah (Yudai Takada) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: tompng (tomoya ishida) via ruby-core @ 2024-12-13 15:58 UTC (permalink / raw)
  To: ruby-core; +Cc: tompng (tomoya ishida)

Issue #20939 has been updated by tompng (tomoya ishida).


I think the cause is same as https://bugs.ruby-lang.org/issues/20927

----------------------------------------
Bug #20939: When using the parse.y parser, it occurs argument stack underflow (-1) if there is processing after the shareable_constant_value: experimental_everything comment and `C = { **{ k: v } }`
https://bugs.ruby-lang.org/issues/20939#change-110998

* Author: ydah (Yudai Takada)
* Status: Open
* ruby -v: ruby 3.4.0dev (2024-12-10T03:31:47Z master f12e2622c1) [arm64-darwin23]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following code will occurs argument stack underflow if it is a parse.y parser.

```ruby
# shareable_constant_value: experimental_everything
C = { **{ k: v } }
p C
```
The following error message is output.

```
ruby 3.4.0dev (2024-12-06T03:32:20Z master 6ccaa37eb3) [arm64-darwin23]
-- raw disasm--------
   trace: 1
   0000 putspecialobject     1                                           (   2)
   0002 putobject            :k                                          (   2)
   0004 putself                                                          (   2)
   0005 opt_send_without_block <calldata:v, 0>                           (   2)
   0007 newhash              2                                           (   2)
   0009 newhash              2                                           (   2)
   0011 opt_send_without_block <calldata:make_shareable, 1>              (   2)
   0013 putspecialobject     3                                           (   2)
*  0015 setconstant          :C                                          (   2)
   trace: 1
   0017 putself                                                          (   3)
   0018 opt_getconstant_path [:C]                                        (   3)
   0020 opt_send_without_block <calldata:p, 1>                           (   3)
   0022 leave                                                            (   3)
---------------------
-e:2: argument stack underflow (-1)
-e: compile error (SyntaxError)
```

It does not occur in the following cases:

```ruby
# shareable_constant_value: experimental_everything
C = { **{ k: v } }
```

```ruby
C = { **{ k: v } }                           
p C
```

```ruby
# shareable_constant_value: experimental_everything
{ **{ k: v } }
p C
```

```ruby
# shareable_constant_value: experimental_everything
C = { **{ k: 1 } }
p C
```

This does not occur in Ruby 3.3:
```
❯ ruby --parser=parse.y -v -e '# shareable_constant_value: experimental_everything

C = { **{ foo: bar } }

p C'
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin23]
-e:3:in `<main>': undefined local variable or method `bar' for main (NameError)

C = { **{ foo: bar } }
               ^^^
```



-- 
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] 3+ messages in thread

* [ruby-core:120418] [Ruby master Bug#20939] When using the parse.y parser, it occurs argument stack underflow (-1) if there is processing after the shareable_constant_value: experimental_everything comment and `C = { **{ k: v } }`
  2024-12-10  4:56 [ruby-core:120147] [Ruby master Bug#20939] When using the parse.y parser, it occurs argument stack underflow (-1) if there is processing after the shareable_constant_value: experimental_everything comment and `C = { **{ k: v } }` ydah (Yudai Takada) via ruby-core
  2024-12-13 15:58 ` [ruby-core:120231] " tompng (tomoya ishida) via ruby-core
@ 2024-12-26 12:02 ` ydah (Yudai Takada) via ruby-core
  1 sibling, 0 replies; 3+ messages in thread
From: ydah (Yudai Takada) via ruby-core @ 2024-12-26 12:02 UTC (permalink / raw)
  To: ruby-core; +Cc: ydah (Yudai Takada)

Issue #20939 has been updated by ydah (Yudai Takada).

Status changed from Open to Closed

Thank you. fixed by: https://github.com/ruby/ruby/pull/12338

----------------------------------------
Bug #20939: When using the parse.y parser, it occurs argument stack underflow (-1) if there is processing after the shareable_constant_value: experimental_everything comment and `C = { **{ k: v } }`
https://bugs.ruby-lang.org/issues/20939#change-111199

* Author: ydah (Yudai Takada)
* Status: Closed
* ruby -v: ruby 3.4.0dev (2024-12-10T03:31:47Z master f12e2622c1) [arm64-darwin23]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The following code will occurs argument stack underflow if it is a parse.y parser.

```ruby
# shareable_constant_value: experimental_everything
C = { **{ k: v } }
p C
```
The following error message is output.

```
ruby 3.4.0dev (2024-12-06T03:32:20Z master 6ccaa37eb3) [arm64-darwin23]
-- raw disasm--------
   trace: 1
   0000 putspecialobject     1                                           (   2)
   0002 putobject            :k                                          (   2)
   0004 putself                                                          (   2)
   0005 opt_send_without_block <calldata:v, 0>                           (   2)
   0007 newhash              2                                           (   2)
   0009 newhash              2                                           (   2)
   0011 opt_send_without_block <calldata:make_shareable, 1>              (   2)
   0013 putspecialobject     3                                           (   2)
*  0015 setconstant          :C                                          (   2)
   trace: 1
   0017 putself                                                          (   3)
   0018 opt_getconstant_path [:C]                                        (   3)
   0020 opt_send_without_block <calldata:p, 1>                           (   3)
   0022 leave                                                            (   3)
---------------------
-e:2: argument stack underflow (-1)
-e: compile error (SyntaxError)
```

It does not occur in the following cases:

```ruby
# shareable_constant_value: experimental_everything
C = { **{ k: v } }
```

```ruby
C = { **{ k: v } }                           
p C
```

```ruby
# shareable_constant_value: experimental_everything
{ **{ k: v } }
p C
```

```ruby
# shareable_constant_value: experimental_everything
C = { **{ k: 1 } }
p C
```

This does not occur in Ruby 3.3:
```
❯ ruby --parser=parse.y -v -e '# shareable_constant_value: experimental_everything

C = { **{ foo: bar } }

p C'
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin23]
-e:3:in `<main>': undefined local variable or method `bar' for main (NameError)

C = { **{ foo: bar } }
               ^^^
```



-- 
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] 3+ messages in thread

end of thread, other threads:[~2024-12-26 12:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-10  4:56 [ruby-core:120147] [Ruby master Bug#20939] When using the parse.y parser, it occurs argument stack underflow (-1) if there is processing after the shareable_constant_value: experimental_everything comment and `C = { **{ k: v } }` ydah (Yudai Takada) via ruby-core
2024-12-13 15:58 ` [ruby-core:120231] " tompng (tomoya ishida) via ruby-core
2024-12-26 12:02 ` [ruby-core:120418] " ydah (Yudai Takada) 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).