mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
- *(int*)1 incorrectly yielded an assert in LLVM IR lowering #2584.
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
- Using `defer catch` with a (void), would cause an assertion. #2580
|
||||
- Fix decl attribute in the wrong place causing an assertion. #2581
|
||||
- Passing a single value to `@wasm` would ignore the renaming.
|
||||
- `*(int*)1` incorrectly yielded an assert in LLVM IR lowering #2584.
|
||||
|
||||
### Stdlib changes
|
||||
|
||||
|
||||
@@ -2371,7 +2371,7 @@ static inline void llvm_emit_deref(GenContext *c, BEValue *value, Expr *inner, T
|
||||
llvm_emit_expr(c, value, inner);
|
||||
llvm_value_rvalue(c, value);
|
||||
AlignSize alignment = type_abi_alignment(type);
|
||||
if (safe_mode_enabled())
|
||||
if (safe_mode_enabled() && !expr_is_const(inner))
|
||||
{
|
||||
LLVMValueRef check = LLVMBuildICmp(c->builder, LLVMIntEQ, value->value, llvm_get_zero(c, inner->type), "checknull");
|
||||
scratch_buffer_clear();
|
||||
|
||||
6
test/test_suite/safe/deref_absolute.c3t
Normal file
6
test/test_suite/safe/deref_absolute.c3t
Normal file
@@ -0,0 +1,6 @@
|
||||
module main;
|
||||
|
||||
fn void main()
|
||||
{
|
||||
int x = *(int*)1;
|
||||
}
|
||||
Reference in New Issue
Block a user