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

Passing wrong keyword args causes hang #1386

Closed
cgay opened this issue Apr 11, 2021 · 1 comment
Closed

Passing wrong keyword args causes hang #1386

cgay opened this issue Apr 11, 2021 · 1 comment
Labels

Comments

@cgay
Copy link
Member

cgay commented Apr 11, 2021

Using Open Dylan 2020.1 or master branch from a few days ago, the following program hangs indefinitely. Remove , help: "help" from the call to print-synopsis and it doesn't hang.

(I feel like I must be missing some obvious mistake because we would have noticed this before.)

#1141 seems at least tangentially relevant, in that open generics are obviously handled quite differently from sealed generics.

==> hang/hang.dylan <==
Module: hang

define open generic print-synopsis
    (parser :: <string>, subcmd :: false-or(<integer>), #key stream);

define method print-synopsis
    (parser :: <string>, subcmd == #f,
     #key stream :: <stream> = *standard-output*)
  format-out("print-synopsis(p, #f)\n");
  force-out();
end method;

define method print-synopsis
    (parser :: <string>, subcmd :: <integer>,
     #key stream :: <stream> = *standard-output*)
  format-out("print-synopsis(p, s)\n");
  force-out();
end method;

// Remove the help arg and no hang.
print-synopsis("string", #f, stream: *standard-output*, help: "help");


==> hang/library.dylan <==
Module: dylan-user

define library hang
  use common-dylan;
  use io;
end library hang;

define module hang
  use common-dylan;
  use format-out;
  use standard-io;
end module hang;

@cgay cgay added the Compiler label Apr 11, 2021
@cgay
Copy link
Member Author

cgay commented Apr 11, 2021

$ lldb _build/bin/hang
(lldb) target create "_build/bin/hang"
Current executable set to '/home/cgay/dylan/play/hang/_build/bin/hang' (x86_64).
(lldb) run
Process 13242 launched: '/home/cgay/dylan/play/hang/_build/bin/hang' (x86_64)
Process 13242 stopped
* thread #1, name = 'Main thread', stop reason = signal SIGSEGV: invalid address (fault address: 0xb)
    frame #0: 0x00007ffff7e2c8cc libdylan.so`rest_key_mep_4 + 412
libdylan.so`rest_key_mep_4:
->  0x7ffff7e2c8cc <+412>: movq   0x8(%r9), %rdi
    0x7ffff7e2c8d0 <+416>: movq   0x8(%rcx), %r14
    0x7ffff7e2c8d4 <+420>: leaq   0x1(%rbx), %r8
    0x7ffff7e2c8d8 <+424>: cmpq   $0x2, %rbx
(lldb) bt
* thread #1, name = 'Main thread', stop reason = signal SIGSEGV: invalid address (fault address: 0xb)
  * frame #0: 0x00007ffff7e2c8cc libdylan.so`rest_key_mep_4 + 412
    frame #1: 0x00007ffff7d3f5fb libdylan.so`invalid-keyword-trap(mepargs=0x00007fffffffe550, disphdr=<unavailable>, engine-node=0x00007ffff6750c40, key=0x00007ffff7fb30a0, keyvec=<un\
available>, implicit?=<unavailable>, .next=<unavailable>, .function=<unavailable>) at boot.dylan:994:5
    frame #2: 0x00007ffff7dc1701 libdylan.so`implicit_keyed_single_method_3 at x86_64-linux-runtime.ll:0
    frame #3: 0x00007ffff7dc0e65 libdylan.so`general_engine_node_n at x86_64-linux-runtime.ll:0
    frame #4: 0x00007ffff7fb02fd libhang.so`_Init_hang__X_hang_for_user + 109
    frame #5: 0x0000000000401149 hang`main + 25
    frame #6: 0x00007ffff722509b libc.so.6`__libc_start_main(main=(hang`main), argc=1, argv=0x00007fffffffe808, init=<unavailable>, fini=<unavailable>, rtld_fini=<unavailable>, stack_\
end=0x00007fffffffe7f8) at libc-start.c:308:16
    frame #7: 0x000000000040106a hang`_start + 42

cgay added a commit to dylan-lang/strings that referenced this issue Apr 11, 2021
I added this while trying to rule out replace-substrings as a cause for
dylan-lang/opendylan#1386 so I might as well
commit it.
@housel housel closed this as completed in e37ba05 Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant