- Compiler segfault when accessing member of number cast to bitstruct #2516.

- Additional fix to #2515
- Compiler assert when getting a member of a `bitstruct : char @bigendian` #2517.
This commit is contained in:
Christoffer Lerno
2025-10-07 00:12:41 +02:00
parent b4b14674b4
commit 04cd079d4e
7 changed files with 40 additions and 6 deletions

View File

@@ -1060,6 +1060,11 @@ static bool sema_analyse_bitstruct(SemaContext *context, Decl *decl, bool *erase
DEBUG_LOG("Beginning analysis of %s.", decl->name ? decl->name : ".anon");
if (!sema_resolve_type_info(context, decl->strukt.container_type, RESOLVE_TYPE_DEFAULT)) return false;
Type *type = type_flatten(decl->strukt.container_type->type->canonical);
if (type_size(type) == 1)
{
decl->strukt.big_endian = false;
decl->strukt.little_endian = false;
}
Type *base_type = type->type_kind == TYPE_ARRAY ? type_flatten(type->array.base) : type;
if (!type_is_integer(base_type))
{