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

BUG: unhandled primitive in codegen: slice_literal #14572

Open
BlobCodes opened this issue May 7, 2024 · 0 comments
Open

BUG: unhandled primitive in codegen: slice_literal #14572

BlobCodes opened this issue May 7, 2024 · 0 comments

Comments

@BlobCodes
Copy link
Contributor

Bug Report

The following code results in a compiler bug:

a = Slice(UInt8).literal(0)
b = Slice(UInt8).literal(1)

This only happens when both variables are not constants (or if there is no assignment at all) and if both literals have the same amount of elements.
This also doesn't happen if the two literals have different types (ex. Slice(UInt32) and Slice(UInt8)).

Stack trace:

BUG: unhandled primitive in codegen: slice_literal (Exception)
  from /crystal/src/compiler/crystal/codegen/codegen.cr:2392:9 in 'visit'
  from /crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
  from /crystal/src/compiler/crystal/codegen/codegen.cr:2392:9 in 'codegen_assign'
  from /crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
  from /crystal/src/enumerable.cr:510:7 in '??'
  from /crystal/src/compiler/crystal/syntax/visitor.cr:27:12 in 'accept'
  from /crystal/src/compiler/crystal/codegen/codegen.cr:2362:7 in 'codegen'
  from /crystal/src/compiler/crystal/compiler.cr:202:16 in 'compile:combine_rpath'
  from /crystal/src/compiler/crystal/compiler.cr:195:56 in 'compile:combine_rpath'
  from /crystal/src/compiler/crystal/command/eval.cr:30:5 in 'eval'
  from /crystal/src/compiler/crystal/command.cr:126:12 in 'run'
  from /crystal/src/compiler/crystal.cr:11:1 in '__crystal_main'
  from /crystal/src/crystal/main.cr:129:5 in 'main'
  from src/env/__libc_start_main.c:95:2 in 'libc_start_main_stage2'

⬢[blob@toolbox ~]$ crystal -v
Crystal 1.12.1 [4cea10199] (2024-04-11)

LLVM: 15.0.7
Default target: x86_64-unknown-linux-gnu

⬢[blob@toolbox ~]$ crystal env
CRYSTAL_CACHE_DIR=/var/home/blob/.cache/crystal
CRYSTAL_PATH=lib:/usr/share/crystal/src
CRYSTAL_VERSION=1.12.1
CRYSTAL_LIBRARY_PATH=/usr/lib64/crystal
CRYSTAL_LIBRARY_RPATH=''
CRYSTAL_OPTS=''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants