mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Stack object size limit error on a static object. #2476
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
- 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
|
||||
- `??` with void results on both sides cause a compiler crash #2472.
|
||||
- Stack object size limit error on a static object. #2476
|
||||
|
||||
### Stdlib changes
|
||||
- Added generic `InterfaceList` to store a list of values that implement a specific interface
|
||||
|
||||
@@ -4817,7 +4817,7 @@ bool sema_analyse_var_decl(SemaContext *context, Decl *decl, bool local, bool *c
|
||||
{
|
||||
if (!sema_set_alloca_alignment(context, decl->type, &decl->alignment)) return false;
|
||||
}
|
||||
if (decl->var.kind == VARDECL_LOCAL && type_size(decl->type) > compiler.build.max_stack_object_size * 1024)
|
||||
if (decl->var.kind == VARDECL_LOCAL && !is_static && type_size(decl->type) > compiler.build.max_stack_object_size * 1024)
|
||||
{
|
||||
size_t size = type_size(decl->type);
|
||||
RETURN_SEMA_ERROR(
|
||||
|
||||
8
test/test_suite/statements/bit_static_local.c3
Normal file
8
test/test_suite/statements/bit_static_local.c3
Normal file
@@ -0,0 +1,8 @@
|
||||
module test;
|
||||
|
||||
fn int main()
|
||||
{
|
||||
static char[(1024 * mem::KB) + 1] a;
|
||||
tlocal char[(1024 * mem::KB) + 1] b;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user