@@ -1299,6 +1299,22 @@ def default() -> AST.ASTExpr:
12991299 compkey = cast (AST .ASTTypComp , hl_addr_tgttype ).compkey
13001300 compinfo = astree .compinfo (compkey )
13011301
1302+ if not compinfo .has_fields ():
1303+ if not anonymous :
1304+ chklogger .logger .error (
1305+ "Struct definition is missing for %s at address %s "
1306+ + "(no fields found)" ,
1307+ compinfo .compname , iaddr )
1308+ return astree .mk_temp_lval_expression ()
1309+
1310+ if not compinfo .has_field_offsets ():
1311+ if not anonymous :
1312+ chklogger .logger .error (
1313+ "Struct definition for %s does not have field offsets "
1314+ + "at address %s" ,
1315+ compinfo .compname , iaddr )
1316+ return astree .mk_temp_lval_expression ()
1317+
13021318 (field , _ ) = compinfo .field_at_offset (0 )
13031319 fieldoffset = astree .mk_field_offset (field .fieldname , compkey )
13041320 return astree .mk_memref_expr (
@@ -1341,6 +1357,22 @@ def default() -> AST.ASTExpr:
13411357 compkey = cast (AST .ASTTypComp , exp1tgttype ).compkey
13421358 compinfo = astree .compinfo (compkey )
13431359
1360+ if not compinfo .has_fields ():
1361+ if not anonymous :
1362+ chklogger .logger .error (
1363+ "Struct definition is missing for %s at address %s "
1364+ + "(no fields found)" ,
1365+ compinfo .compname , iaddr )
1366+ return astree .mk_temp_lval_expression ()
1367+
1368+ if not compinfo .has_field_offsets ():
1369+ if not anonymous :
1370+ chklogger .logger .error (
1371+ "Struct definition for %s does not have field offsets "
1372+ + "at address %s" ,
1373+ compinfo .compname , iaddr )
1374+ return astree .mk_temp_lval_expression ()
1375+
13441376 scalaroffset = cast (AST .ASTIntegerConstant , exp2 ).cvalue
13451377 (field , rem ) = compinfo .field_at_offset (scalaroffset )
13461378 if rem > 0 :
0 commit comments