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

repeated 0.substr(-10) leads to segfault #736

Closed
p6rt opened this issue Mar 2, 2009 · 7 comments
Closed

repeated 0.substr(-10) leads to segfault #736

p6rt opened this issue Mar 2, 2009 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Mar 2, 2009

Migrated from rt.perl.org#63592 (status was 'resolved')

Searchable as RT63592$

@p6rt
Copy link
Author

p6rt commented Mar 2, 2009

From @moritz

Rakudo 08b789048​:
$ time perl6 -e 'while 1 { 0.substr(-10) }'
Segmentation fault

real 0m3.535s

0x00007fb33aebab14 in Parrot_FixedIntegerArray_get_integer
(interp=Cannot access
memory at address 0x7fff42d83ff8
)
  at ./src/pmc/fixedintegerarray.c​:127
127 Parrot_FixedIntegerArray_get_integer(PARROT_INTERP, PMC *pmc)
(gdb) bt
#​0 0x00007fb33aebab14 in Parrot_FixedIntegerArray_get_integer
(interp=Cannot ac
cess memory at address 0x7fff42d83ff8
)
  at ./src/pmc/fixedintegerarray.c​:127
#​1 0x00007fb33aebaac9 in Parrot_FixedIntegerArray_elements
(interp=0x16f4010,
  pmc=0x2ba3f60) at ./src/pmc/fixedintegerarray.pmc​:225
#​2 0x00007fb33aebcc14 in Parrot_FixedIntegerArray_get_integer_keyed_int (
  interp=0x16f4010, pmc=0x2ba3f60, key=0)
  at ./src/pmc/fixedintegerarray.pmc​:256
#​3 0x00007fb33ad29486 in next_arg_sig (interp=0x16f4010,
sti=0x7fff42d841c8)
  at src/call/pcc.c​:717
#​4 0x00007fb33ad2d9b1 in Parrot_process_args (interp=0x16f4010,
  st=0x7fff42d84170, param_or_result=PARROT_PASS_PARAMS)
  at src/call/pcc.c​:1638
#​5 0x00007fb33ad2e0eb in parrot_pass_args (interp=0x16f4010,
  src_ctx=0x1c08ab0, dest_ctx=0x1bae960, src_indexes=0x7fff42d86440,
  dest_indexes=0x7fff42d84290, param_or_result=PARROT_PASS_PARAMS)
  at src/call/pcc.c​:1882
#​6 0x00007fb33aec15c8 in Parrot_Iterator_nci_set_key (interp=0x16f4010,
  pmc=0x1794510)
  at
/home/moritz/rakudo/parrot/tools/build/../../lib/Parrot/Pmc2c/PCCMETHOD.p
m​:442
#​7 0x00007fb33ae6b367 in Parrot_NCI_invoke (interp=0x16f4010,
pmc=0x1794510,
  next=0x0) at ./src/pmc/nci.pmc​:330
#​8 0x00007fb33ad2c78e in Parrot_PCCINVOKE (interp=0x16f4010,
pmc=0x2ba45f0,
  method_name=0x170d650, signature=0x7fb33b01430c "P->")
  at src/call/pcc.c​:2846
#​9 0x00007fb33af066c4 in Parrot_FixedPMCArray_get_iter (interp=0x16f4010,
  pmc=0x2ba4740) at ./src/pmc/fixedpmcarray.pmc​:664
#​10 0x00007fb33ad83f88 in Parrot_cx_find_handler_local (interp=0x16f4010,
  task=0x2ba4650) at src/scheduler.c​:881
#​11 0x00007fb33ad126a3 in Parrot_ex_throw_from_c (interp=0x16f4010,
  exception=0x2ba4650) at src/exceptions.c​:304
#​12 0x00007fb33ad12a64 in Parrot_ex_throw_from_c_args (interp=0x16f4010,
  ret_addr_unused=0x0, exitcode=7,
  format=0x7fb33afacb28 "Cannot take substr outside string")
  at src/exceptions.c​:409
#​13 0x00007fb33ac924b8 in Parrot_str_substr (interp=0x16f4010,
  src=0x7fb336a46368, offset=-10, length=1, d=0x397ef28, replace_dest=0)
  at src/string/api.c​:1155
#​14 0x00007fb33acb1059 in Parrot_substr_s_s_i_i (cur_opcode=0x7fb33b3cb858,
  interp=0x16f4010) at src/ops/string.ops​:266
#​15 0x00007fb33ad83795 in runops_slow_core (interp=0x16f4010,
  pc=0x7fb33b3cb858) at src/runops_cores.c​:459
#​16 0x00007fb33ad332e5 in runops_int (interp=0x16f4010, offset=13078)
  at src/interpreter.c​:978
#​17 0x00007fb33ad33dea in runops (interp=0x16f4010, offs=13078)
  at src/call/ops.c​:106
#​18 0x00007fb33ad341c2 in runops_args (interp=0x16f4010, sub=0x2ba6060,
  obj=0x1780790, meth_unused=0x0, sig=0x7fb33afbdc2c "vP",
ap=0x7fff42d889f0)
  at src/call/ops.c​:253
#​19 0x00007fb33ad3557c in Parrot_runops_fromc_args (interp=0x16f4010,
  sub=0x2ba6060, sig=0x7fb33afbdc2c "vP") at src/call/ops.c​:320
#​20 0x00007fb33ad1288d in Parrot_ex_throw_from_c (interp=0x16f4010,
  exception=0x2ba6000) at src/exceptions.c​:340
#​21 0x00007fb33ad12a64 in Parrot_ex_throw_from_c_args (interp=0x16f4010,
  ret_addr_unused=0x0, exitcode=7,
  format=0x7fb33afacb28 "Cannot take substr outside string")
  at src/exceptions.c​:409
#​22 0x00007fb33ac924b8 in Parrot_str_substr (interp=0x16f4010,
  src=0x7fb336a48e70, offset=-10, length=1, d=0x3976628, replace_dest=0)
  at src/string/api.c​:1155
#​23 0x00007fb33acb1059 in Parrot_substr_s_s_i_i (cur_opcode=0x7fb33b3cb858,
  interp=0x16f4010) at src/ops/string.ops​:266
#​24 0x00007fb33ad83795 in runops_slow_core (interp=0x16f4010,
  pc=0x7fb33b3cb858) at src/runops_cores.c​:459
#​25 0x00007fb33ad332e5 in runops_int (interp=0x16f4010, offset=13078)
  at src/interpreter.c​:978
#​26 0x00007fb33ad33dea in runops (interp=0x16f4010, offs=13078)
  at src/call/ops.c​:106
...

--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/

@p6rt
Copy link
Author

p6rt commented Jul 2, 2009

From @coke

On Mon Mar 02 01​:03​:59 2009, mlenz@​physik.uni-wuerzburg.de wrote​:

Rakudo 08b789048​:
$ time perl6 -e 'while 1 { 0.substr(-10) }'
Segmentation fault

real 0m3.535s

Here's a pure PIR version; based on --target=pir and then trimmed down
to the bare minimum to cause a segfault.

.sub 'main'
  loop31_test​:
  push_eh fail
  $S1 = substr '0', -10, 1
  pop_eh
  # die 'not reachable'
  fail​:
  pop_eh
  goto loop31_test
.end

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jul 2, 2009

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

@p6rt
Copy link
Author

p6rt commented Jul 2, 2009

From julian.notfound@gmail.com

Created track ticket TT #​804 as RFC with a patch that modifies throwing
of exceptions from C that might solve this problem. With it the pir
example runs forever.
Please put comments about it on trac, not here.

@p6rt
Copy link
Author

p6rt commented Jul 2, 2009

From @coke

On Thu Jul 02 13​:01​:25 2009, julianalbo wrote​:

Created track ticket TT #​804 as RFC with a patch that modifies throwing
of exceptions from C that might solve this problem. With it the pir
example runs forever.

Tested the original perl6 snippet with this patch, it also avoids the
segfault, FYI. (And merely leaks memory very slowly)

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

From @moritz

This segfault is now gone.

@p6rt
Copy link
Author

p6rt commented Mar 9, 2010

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Mar 9, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant