From 9d52df3df222aafa932d42b35fcf7ed0d6f37bff Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Thu, 18 Jun 2026 20:56:27 +0000 Subject: [PATCH] pointer_expr: object-address of struct members with non-constant width When the byte offset of a struct member cannot be computed (struct with non-constant-width members), fall back to using the member expression itself as the object rather than asserting. Co-authored-by: Kiro --- src/util/pointer_expr.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/util/pointer_expr.cpp b/src/util/pointer_expr.cpp index 7de79c38a1c..2f3b2e9d8cc 100644 --- a/src/util/pointer_expr.cpp +++ b/src/util/pointer_expr.cpp @@ -61,7 +61,13 @@ static void build_object_descriptor_rec( build_object_descriptor_rec(ns, struct_op, dest); auto offset = member_offset_expr(member, ns); - CHECK_RETURN(offset.has_value()); + if(!offset.has_value()) + { + // Cannot compute offset for structs with non-constant-width members; + // set object to the member expression itself + dest.object() = member; + return; + } dest.offset() = plus_exprt( dest.offset(),