Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with precompile + add_method #4646

Open
p6rt opened this issue Oct 13, 2015 · 5 comments
Open

with precompile + add_method #4646

p6rt opened this issue Oct 13, 2015 · 5 comments
Labels
SEGV Segmentation fault, bus error, etc.

Comments

@p6rt
Copy link

p6rt commented Oct 13, 2015

Migrated from rt.perl.org#126350 (status was 'open')

Searchable as RT126350$

@p6rt
Copy link
Author

p6rt commented Oct 13, 2015

From shoichikaji@gmail.com

The following script exits with segmentation fault.
(code is also available at
https://gist.github.com/shoichikaji/42f03675cec2d6b4a489)

```
#!/bin/bash

set -xu

rm -rf lib
mkdir lib

cat >lib/A.pm6 <<'EOF';
class B {}
class A {
  sub foo($b, *@​) {}
  BEGIN {
  B.^add_method​: 'bar', method () { foo(self) };
  }
}
EOF

perl6-m --target=mbc --output=lib/A.pm6.moarvm lib/A.pm6
perl6-m -Ilib -MA -e 'B.bar'
```

```
$ bash test.sh
+ rm -rf lib
+ mkdir lib
+ cat
+ perl6-m --target=mbc --output=lib/A.pm6.moarvm lib/A.pm6
+ perl6-m -Ilib -MA -e B.bar
test.sh​: line 19​: 31493 Segmentation fault perl6-m -Ilib -MA -e 'B.bar'
```

My perl version is​:
$ perl6-m -v
This is perl6 version 2015.09-360-g154f44b built on MoarVM version
2015.09-79-gee9fc2b

@p6rt
Copy link
Author

p6rt commented Oct 13, 2015

From @FROGGS

It seems to segfault in the op getlex when trying to locate &foo.

Moving sub foo to within the BEGIN block helps and moving it outside of A gives​:
Cannot invoke this object
  in method <anon> at lib/A.pm6​:5

Neither the rakudo optimizer nor spesh seem to be to blame.

@p6rt
Copy link
Author

p6rt commented Oct 13, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 13, 2015

From @FROGGS

To clarify​: f in getlex after the while loop is null.

@p6rt
Copy link
Author

p6rt commented Oct 14, 2015

From @nwc10

On Tue, Oct 13, 2015 at 09​:20​:54AM -0700, Shoichi Kaji wrote​:

+ perl6-m -Ilib -MA -e B.bar
test.sh​: line 19​: 31493 Segmentation fault perl6-m -Ilib -MA -e 'B.bar'
```

$ ./perl6-m -Ilib -MA -e 'B.bar'
ASAN​:SIGSEGV

==27416==ERROR​: AddressSanitizer​: SEGV on unknown address 0x000000000008 (pc 0x7f78d5719316 sp 0x7fffff5a7640 bp 0x7fffff5a8ff0 T0)
  #​0 0x7f78d5719315 in MVM_interp_run src/core/interp.c​:196
  #​1 0x7f78d59e757e in MVM_vm_run_file src/moar.c​:243
  #​2 0x401a4f in main src/main.c​:191
  #​3 0x7f78d4f7ad5c in __libc_start_main (/lib64/libc.so.6+0x1ed5c)
  #​4 0x401058 (/home/nicholas/Sandpit/moar-san/bin/moar+0x401058)

AddressSanitizer can not provide additional info.
SUMMARY​: AddressSanitizer​: SEGV src/core/interp.c​:196 MVM_interp_run
==27416==ABORTING

So there's nothing wrong happening before a NULL pointer dereference.

Nicholas Clark

@p6rt p6rt added the SEGV Segmentation fault, bus error, etc. label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SEGV Segmentation fault, bus error, etc.
Projects
None yet
Development

No branches or pull requests

1 participant