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

Use correct string size for LLVM::Type#inline_asm #14265

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions spec/compiler/codegen/asm_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ require "../../spec_helper"
describe "Code gen: asm" do
# TODO: arm asm tests
{% if flag?(:i386) || flag?(:x86_64) %}
it "passes correct string length to LLVM" do
run <<-CRYSTAL
asm("// 😂😂
nop
nop")
CRYSTAL
end

it "codegens without inputs" do
run(%(
dst = uninitialized Int32
Expand Down
8 changes: 4 additions & 4 deletions src/llvm/type.cr
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ struct LLVM::Type
LibLLVM.get_inline_asm(
self,
asm_string,
asm_string.size,
asm_string.bytesize,
constraints,
constraints.size,
constraints.bytesize,
(has_side_effects ? 1 : 0),
(is_align_stack ? 1 : 0),
LibLLVM::InlineAsmDialect::ATT
Expand All @@ -190,9 +190,9 @@ struct LLVM::Type
LibLLVM.get_inline_asm(
self,
asm_string,
asm_string.size,
asm_string.bytesize,
constraints,
constraints.size,
constraints.bytesize,
(has_side_effects ? 1 : 0),
(is_align_stack ? 1 : 0),
LibLLVM::InlineAsmDialect::ATT,
Expand Down
Loading