mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Compiler hang with unaligned load-store pair. #2470
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
- Overloading &[] should be enough for foreach. #2466
|
||||
- Any register allowed in X86_64 inline asm address. #2463
|
||||
- int val = some_int + some_distinct_inline_int errors that int cannot be cast to DistinctInt #2468
|
||||
- Compiler hang with unaligned load-store pair. #2470
|
||||
|
||||
### Stdlib changes
|
||||
- Added generic `InterfaceList` to store a list of values that implement a specific interface
|
||||
|
||||
@@ -169,10 +169,9 @@ INLINE void llvm_emit_unaligned_store(GenContext *c, BEValue *result_value, Expr
|
||||
c->emitting_load_store_check = true;
|
||||
BEValue value;
|
||||
llvm_emit_expr(c, &value, expr->call_expr.arguments[0]);
|
||||
llvm_value_rvalue(c, &value);
|
||||
llvm_emit_expr(c, result_value, expr->call_expr.arguments[1]);
|
||||
llvm_value_deref(c, &value);
|
||||
value.alignment = expr->call_expr.arguments[2]->const_expr.ixx.i.low;
|
||||
llvm_store(c, &value, result_value);
|
||||
llvm_store_to_ptr_aligned(c, value.value, result_value, expr->call_expr.arguments[2]->const_expr.ixx.i.low);
|
||||
c->emitting_load_store_check = emit_check;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
|
||||
struct Foo
|
||||
|
||||
23
test/test_suite/builtins/unaligned_load_store_chain.c3t
Normal file
23
test/test_suite/builtins/unaligned_load_store_chain.c3t
Normal file
@@ -0,0 +1,23 @@
|
||||
// #target: macos-x64
|
||||
module test;
|
||||
module test;
|
||||
import std, libc;
|
||||
|
||||
fn void unaligned_load_store(void* dst, void* src) @nostrip
|
||||
{
|
||||
$$unaligned_store(dst, $$unaligned_load((char*)src, 2), 2);
|
||||
}
|
||||
|
||||
fn int main()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* #expect: test.ll
|
||||
|
||||
define void @test.unaligned_load_store(ptr %0, ptr %1) #0 {
|
||||
entry:
|
||||
%2 = load i8, ptr %1, align 2
|
||||
store i8 %2, ptr %0, align 2
|
||||
ret void
|
||||
}
|
||||
Reference in New Issue
Block a user