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

Internal error if trying to assign a unit var of unit type with struct init #1275

Closed
bbannier opened this issue Oct 11, 2022 · 1 comment · Fixed by #1471
Closed

Internal error if trying to assign a unit var of unit type with struct init #1275

bbannier opened this issue Oct 11, 2022 · 1 comment · Fixed by #1471
Assignees
Labels
Bug Something isn't working

Comments

@bbannier
Copy link
Member

If I try to assign to a unit var which is of unit type with struct init syntax I hit an internal error.

$ spicy-config --version
1.6.0-dev.55 (851ec8b9)
$ cat bla.spicy
module bla;

type X = unit {
	x: uint8;
};

public type Y = unit {
	var x: X;
	y: uint8 { self.x = [$x = $$]; }
};

$ spicyc -j bla.spicy
[internal-error] bla.spicy:9:22: ctor spicy::ctor::Unit failed to compile

--- Aborting
# 0   libhilti.dylib                      0x000000010f1103a6 _ZN5hilti2rt9BacktraceC1Ev + 166
# 1   libhilti.dylib                      0x000000010eae29db _ZN5hilti4util20abort_with_backtraceEv + 139
# 2   libhilti.dylib                      0x000000010eadbf67 _ZN5hilti6Logger13internalErrorERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS_8LocationE + 55
# 3   libhilti.dylib                      0x000000010eb185c5 _ZN5hilti6Logger13internalErrorINS_4ctor6detail4CtorELPv0EEEvNSt3__112basic_stringIcNS6_11char_traitsIcEENS6_9allocatorIcEEEERKT_ + 149
# 4   libhilti.dylib                      0x000000010eb1842c _ZN5hilti6detail7CodeGen7compileERKNS_4ctor6detail4CtorEb + 700
# 5   libhilti.dylib                      0x000000010eb2762f _ZN5hilti6detail7visitor11do_dispatchINS0_3cxx10ExpressionENS_10expression6detail10ExpressionEN12_GLOBAL__N_17VisitorENS1_8IteratorINS_4NodeELNS1_5OrderE0ELb0EEEEENSt3__111conditionalIXsr3stdE9is_void_vIT_EEbNSE_8optionalISG_EEE4typeERT0_RT1_RNT2_8PositionERb + 879
# 6   libhilti.dylib                      0x000000010eb262b4 _ZN5hilti6detail7CodeGen7compileERKNS_10expression6detail10ExpressionEb + 2196
# 7   libhilti.dylib                      0x000000010eb28b19 _ZN12_GLOBAL__N_17VisitorclERKN5hilti10expression7CoercedE + 57
# 8   libhilti.dylib                      0x000000010eb275f8 _ZN5hilti6detail7visitor11do_dispatchINS0_3cxx10ExpressionENS_10expression6detail10ExpressionEN12_GLOBAL__N_17VisitorENS1_8IteratorINS_4NodeELNS1_5OrderE0ELb0EEEEENSt3__111conditionalIXsr3stdE9is_void_vIT_EEbNSE_8optionalISG_EEE4typeERT0_RT1_RNT2_8PositionERb + 824
# 9   libhilti.dylib                      0x000000010eb262b4 _ZN5hilti6detail7CodeGen7compileERKNS_10expression6detail10ExpressionEb + 2196
# 10  libhilti.dylib                      0x000000010eb27e4a _ZN12_GLOBAL__N_17VisitorclERKN5hilti10expression6AssignE + 90
# 11  libhilti.dylib                      0x000000010eb275b0 _ZN5hilti6detail7visitor11do_dispatchINS0_3cxx10ExpressionENS_10expression6detail10ExpressionEN12_GLOBAL__N_17VisitorENS1_8IteratorINS_4NodeELNS1_5OrderE0ELb0EEEEENSt3__111conditionalIXsr3stdE9is_void_vIT_EEbNSE_8optionalISG_EEE4typeERT0_RT1_RNT2_8PositionERb + 752
# 12  libhilti.dylib                      0x000000010eb262b4 _ZN5hilti6detail7CodeGen7compileERKNS_10expression6detail10ExpressionEb + 2196
# 13  libhilti.dylib                      0x000000010eb53ebf _ZN5hilti6detail7visitor11do_dispatchIvNS_9statement6detail9StatementEN12_GLOBAL__N_17VisitorENS1_8IteratorINS_4NodeELNS1_5OrderE0ELb0EEEEENSt3__111conditionalIXsr3stdE9is_void_vIT_EEbNSC_8optionalISE_EEE4typeERT0_RT1_RNT2_8PositionERb + 6879
# 14  libhilti.dylib                      0x000000010eb4e290 _ZN5hilti6detail7visitor7VisitorIvN12_GLOBAL__N_17VisitorENS_4NodeELNS1_5OrderE0EE8dispatchERKS5_ + 2928
# 15  libhilti.dylib                      0x000000010eb5718a _ZN12_GLOBAL__N_17VisitorclERKN5hilti9statement5BlockE + 1066
# 16  libhilti.dylib                      0x000000010eb537aa _ZN5hilti6detail7visitor11do_dispatchIvNS_9statement6detail9StatementEN12_GLOBAL__N_17VisitorENS1_8IteratorINS_4NodeELNS1_5OrderE0ELb0EEEEENSt3__111conditionalIXsr3stdE9is_void_vIT_EEbNSC_8optionalISE_EEE4typeERT0_RT1_RNT2_8PositionERb + 5066
# 17  libhilti.dylib                      0x000000010eb4e290 _ZN5hilti6detail7visitor7VisitorIvN12_GLOBAL__N_17VisitorENS_4NodeELNS1_5OrderE0EE8dispatchERKS5_ + 2928
# 18  libhilti.dylib                      0x000000010eb4d2f1 _ZN5hilti6detail7CodeGen7compileERKNS_9statement6detail9StatementEPNS0_3cxx5BlockE + 465
# 19  libhilti.dylib                      0x000000010eaf183b _ZN12_GLOBAL__N_17VisitorclERKN5hilti11declaration8FunctionENS1_7visitor8PositionIRNS1_4NodeEEE + 2571
# 20  libhilti.dylib                      0x000000010eaea817 _ZN5hilti6detail7visitor7VisitorIvN12_GLOBAL__N_17VisitorENS_4NodeELNS1_5OrderE0EE8dispatchERKS5_ + 1671
# 21  libhilti.dylib                      0x000000010eae976b _ZN5hilti6detail7CodeGen13compileModuleERNS_4NodeEPNS_4UnitEb + 523
# 22  libhilti.dylib                      0x000000010ec8147d _ZN5hilti4Unit7codegenEv + 957
# 23  libhilti.dylib                      0x000000010ec2e44f _ZN5hilti6Driver13_codegenUnitsEv + 1087
# 24  libhilti.dylib                      0x000000010ec2fa35 _ZN5hilti6Driver12compileUnitsEv + 2453
# 25  libhilti.dylib                      0x000000010ec3034d _ZN5hilti6Driver7compileEv + 45
# 26  libhilti.dylib                      0x000000010ec2fec9 _ZN5hilti6Driver3runEv + 185
# 27  spicyc                              0x000000010cc5de97 main + 311
# 28  dyld                                0x00000001176ac52e start + 462
@bbannier bbannier added the Bug Something isn't working label Oct 11, 2022
@bbannier
Copy link
Member Author

bbannier commented Oct 11, 2022

Looks like this never worked. We added support for initializing units with struct init syntax in ea85cd7 (#1145); before that this code was rejected, after that commit we trigger the interal error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant