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

global UGen inside class definition crashes #454

Open
gewang opened this issue Jul 23, 2024 · 1 comment
Open

global UGen inside class definition crashes #454

gewang opened this issue Jul 23, 2024 · 1 comment
Assignees
Labels

Comments

@gewang
Copy link
Member

gewang commented Jul 23, 2024

class Foo
{
    Gain boo => global Gain bar => dac;
}

Foo foo;

on macOS, this indeterministically crashes

ge@metroplex src % ./chuck b.ck   
(internal error) unhandled UGen add: outs: 1 ins: 0
Assertion failed: (FALSE), function add, file chuck_ugen.cpp, line 557.
zsh: abort      ./chuck b.ck
ge@metroplex src % ./chuck b.ck
Assertion failed: (inlet() != NULL), function add, file chuck_ugen.cpp, line 489.
zsh: abort      ./chuck b.ck
ge@metroplex src % ./chuck b.ck
(internal error) unhandled UGen add: outs: 1 ins: 0
Assertion failed: (FALSE), function add, file chuck_ugen.cpp, line 557.
zsh: abort      ./chuck b.ck
ge@metroplex src % ./chuck b.ck
zsh: segmentation fault  ./chuck b.ck
ge@metroplex src % ./chuck b.ck
(internal error) unhandled UGen add: outs: 1 ins: 0
Assertion failed: (FALSE), function add, file chuck_ugen.cpp, line 557.
zsh: abort      ./chuck b.ck

VM bytecode instruction dump

ge@metroplex src % ./chuck +d b.ck
[b.ck]: dumping class Foo:
[b.ck]: -------
[b.ck]: Gain boo => global Gain bar => dac;
[b.ck]: [0] Chuck_Instr_Instantiate_Object( Gain )
[b.ck]: [1] Chuck_Instr_Pre_Constructor( ctor='class Object', offset=8 )
[b.ck]: [2] Chuck_Instr_Alloc_Member_Word( 8 )
[b.ck]: [3] Chuck_Instr_Assign_Object(  )
[b.ck]: [4] Chuck_Instr_Alloc_Member_Word( 16 )
[b.ck]: [5] Chuck_Instr_UGen_Link(  )
[b.ck]: [6] Chuck_Instr_DAC(  )
[b.ck]: [7] Chuck_Instr_UGen_Link(  )
[b.ck]: [8] Chuck_Instr_Reg_Pop_Int(  )
[b.ck]: [9] Chuck_Instr_Func_Return(  )
[b.ck]: -------

[b.ck]: dumping b.ck:
[b.ck]: -------
[b.ck]: Foo foo;
[b.ck]: [0] Chuck_Instr_Instantiate_Object( Foo )
[b.ck]: [1] Chuck_Instr_Pre_Constructor( ctor='class Object', offset=0 )
[b.ck]: [2] Chuck_Instr_Pre_Constructor( ctor='class Foo', offset=0 )
[b.ck]: [3] Chuck_Instr_Alloc_Word( 0 )
[b.ck]: [4] Chuck_Instr_Assign_Object(  )
[b.ck]: [5] Chuck_Instr_Reg_Pop_WordsMulti( 2 )
[b.ck]: [6] Chuck_Instr_Release_Object2( 0 )
[b.ck]: [7] Chuck_Instr_EOC(  )
[b.ck]: -------

zsh: segmentation fault  ./chuck +d b.ck
@gewang
Copy link
Member Author

gewang commented Jul 23, 2024

FYI
this crash is circumvented if the global Gain is declared outside the class definition

global Gain bar;

class Foo
{
    Gain boo => bar => dac;
}

Foo foo;

VM instruction dump:

ge@metroplex src % ./chuck +d c.ck
[c.ck]: dumping class Foo:
[c.ck]: -------
[c.ck]: Gain boo => bar => dac;
[c.ck]: [0] Chuck_Instr_Instantiate_Object( Gain )
[c.ck]: [1] Chuck_Instr_Pre_Constructor( ctor='class Object', offset=8 )
[c.ck]: [2] Chuck_Instr_Alloc_Member_Word( 8 )
[c.ck]: [3] Chuck_Instr_Assign_Object(  )
[c.ck]: [4] Chuck_Instr_Reg_Push_Global( name='bar' )
[c.ck]: [5] Chuck_Instr_UGen_Link(  )
[c.ck]: [6] Chuck_Instr_DAC(  )
[c.ck]: [7] Chuck_Instr_UGen_Link(  )
[c.ck]: [8] Chuck_Instr_Reg_Pop_Int(  )
[c.ck]: [9] Chuck_Instr_Func_Return(  )
[c.ck]: -------

[c.ck]: dumping c.ck:
[c.ck]: -------
[c.ck]: global Gain bar;
[c.ck]: [0] Chuck_Instr_Alloc_Word_Global( name='bar' )
[c.ck]: [1] Chuck_Instr_Reg_Pop_WordsMulti( 2 )
[c.ck]: Foo foo;
[c.ck]: [2] Chuck_Instr_Instantiate_Object( Foo )
[c.ck]: [3] Chuck_Instr_Pre_Constructor( ctor='class Object', offset=8 )
[c.ck]: [4] Chuck_Instr_Pre_Constructor( ctor='class Foo', offset=8 )
[c.ck]: [5] Chuck_Instr_Alloc_Word( 8 )
[c.ck]: [6] Chuck_Instr_Assign_Object(  )
[c.ck]: [7] Chuck_Instr_Reg_Pop_WordsMulti( 2 )
[c.ck]: [8] Chuck_Instr_Release_Object2( 8 )
[c.ck]: [9] Chuck_Instr_EOC(  )
[c.ck]: -------

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

2 participants