diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-12-01 22:16:37 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-12-01 22:16:37 +0100 |
| commit | 7e9ceaa281f52488398c42fb803fb14bcd8f76bb (patch) | |
| tree | aaa970099b05e4fb3e37b7ff52ce9f90ab1e0b17 /src/check_stmt.cpp | |
| parent | ac61f083fae80197db37d286ac1259d32b587ba9 (diff) | |
Fix #5982
Add escape analysis check for #load directive to fix #5982.
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 5e7a8e323..835f0162a 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -2596,6 +2596,10 @@ void check_unsafe_return(Operand const &o, Type *type, Ast *expr) { unsafe_return_error(o, "a slice of a compound literal"); } } else if (o.mode == Addressing_Constant && is_type_slice(type)) { + if (is_load_directive_call(o.expr)) { + return; + } + ERROR_BLOCK(); unsafe_return_error(o, "a compound literal of a slice"); error_line("\tNote: A constant slice value will use the memory of the current stack frame\n"); |