crystal
crystal copied to clipboard
Internal compiler error when lib fun takes or returns packed struct by value
Tested on d44530d88 with LLVM 10.0.0 and x86_64-unknown-linux-gnu
target. This only happens to structs that would have contained padding between members if @[Packed]
were absent.
lib L
@[Packed]
struct T
a : Int8
b : Int16
end
fun f : T
fun g(x : T)
end
L.f # or L.g(L::T.new)
Index out of bounds (IndexError)
from ../../../crystal/src/indexable.cr:589:8 in 'unify'
from ../../../crystal/src/llvm/abi/x86_64.cr:77:9 in 'classify'
from ../../../crystal/src/llvm/abi/x86_64.cr:111:20 in 'classify'
from ../../../crystal/src/llvm/type.cr:25:5 in 'classify'
from ../../../crystal/src/indexable.cr:403:3 in 'abi_info'
from ../../../crystal/src/compiler/crystal/codegen/call.cr:153:7 in 'prepare_call_args_external'
from ../../../crystal/src/compiler/crystal/codegen/call.cr:55:7 in 'visit'
from ../../../crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
from ../../../crystal/src/compiler/crystal/codegen/codegen.cr:621:9 in 'accept'
from ../../../crystal/src/compiler/crystal/codegen/codegen.cr:2152:7 in 'codegen'
from ../../../crystal/src/compiler/crystal/compiler.cr:172:16 in 'compile'
from ../../../crystal/src/compiler/crystal/command.cr:210:5 in 'run_command'
from ../../../crystal/src/compiler/crystal/command.cr:117:7 in 'run'
from ../../../crystal/src/crystal/main.cr:105:5 in 'main'
from src/env/__libc_start_main.c:94:2 in 'libc_start_main_stage2'
The current stack trace is:
Index out of bounds (IndexError)
from src/indexable.cr:73:20 in '[]'
from src/llvm/abi/x86_64.cr:210:10 in 'unify'
from src/llvm/abi/x86_64.cr:122:9 in 'classify'
from src/llvm/abi/x86_64.cr:155:7 in 'classify_struct'
from src/llvm/abi/x86_64.cr:136:7 in 'classify'
from src/llvm/abi/x86_64.cr:107:7 in 'classify'
from src/llvm/abi/x86_64.cr:55:13 in 'abi_info'
from src/compiler/crystal/codegen/fun.cr:388:5 in 'abi_info'
from src/compiler/crystal/codegen/call.cr:153:7 in 'call_abi_info'
from src/compiler/crystal/codegen/call.cr:159:16 in 'prepare_call_args_external'
from src/compiler/crystal/codegen/call.cr:55:7 in 'prepare_call_args'
from src/compiler/crystal/codegen/call.cr:21:26 in 'visit'
from src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
from src/compiler/crystal/codegen/codegen.cr:2281:7 in 'accept'
from src/compiler/crystal/codegen/codegen.cr:667:9 in 'visit'
from src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
from src/compiler/crystal/codegen/codegen.cr:2281:7 in 'accept'
from src/compiler/crystal/codegen/codegen.cr:69:7 in 'codegen'
from src/compiler/crystal/codegen/codegen.cr:67:5 in 'codegen:debug:single_module'
from src/compiler/crystal/progress_tracker.cr:22:7 in 'codegen'
from src/compiler/crystal/compiler.cr:173:16 in 'compile'
from src/compiler/crystal/command.cr:314:3 in 'compile'
from src/compiler/crystal/command.cr:218:14 in 'run_command'
from src/compiler/crystal/command.cr:127:7 in 'run'
from src/compiler/crystal/command.cr:51:5 in 'run'
from src/compiler/crystal/command.cr:50:3 in 'run'
from src/compiler/crystal.cr:11:1 in '__crystal_main'
from src/crystal/main.cr:115:5 in 'main_user_code'
from src/crystal/main.cr:101:7 in 'main'
from src/crystal/main.cr:127:3 in 'main'
from /lib/x86_64-linux-gnu/libc.so.6 in '__libc_start_main'
Can confirm this is still an issue with Crystal 1.9.2 are there any plans to fix this?