Using a non-const as the end range for a bitstruct would trigger an assert.

This commit is contained in:
Christoffer Lerno
2025-05-17 18:55:53 +02:00
parent a91330b7d1
commit 8ada2a70d9
3 changed files with 17 additions and 1 deletions

View File

@@ -825,7 +825,7 @@ static inline bool sema_analyse_bitstruct_member(SemaContext *context, Decl *par
if (end)
{
// Analyse the end
if (!sema_analyse_expr(context, start)) return false;
if (!sema_analyse_expr(context, end)) return false;
if (!sema_cast_const(end) || !type_is_integer(end->type) || int_is_neg(end->const_expr.ixx))
{
SEMA_ERROR(end, "This must be a constant non-negative integer value.");