Skip to content

Commit 2304753

Browse files
committed
FSUM: remove lhsnames from summaries
1 parent 60871b3 commit 2304753

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

chb/api/CallTargetInfo.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ def __init__(
5050
self,
5151
calltarget: "CallTarget",
5252
targetinterface: "AppFunctionInterface",
53-
targetsemantics: "AppFunctionSemantics",
54-
lhsname: Optional[str] = None) -> None:
53+
targetsemantics: "AppFunctionSemantics"
54+
) -> None:
5555
self._tgt = calltarget
5656
self._fintf = targetinterface
5757
self._fsem = targetsemantics
58-
self._lhsname = lhsname
5958

6059
@property
6160
def calltarget(self) -> "CallTarget":
@@ -69,10 +68,6 @@ def target_interface(self) -> "AppFunctionInterface":
6968
def target_semantics(self) -> "AppFunctionSemantics":
7069
return self._fsem
7170

72-
@property
73-
def lhsname(self) -> Optional[str]:
74-
return self._lhsname
75-
7671
def __str__(self) -> str:
7772
lines: List[str] = []
7873
lines.append(" " + str(self.calltarget))

chb/app/CHVersion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
chbversion: str = "0.3.0-20240830"
1+
chbversion: str = "0.3.0-20241003"

chb/app/FunctionInfo.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,15 @@ def calltargetinfos(self) -> Mapping[str, CallTargetInfo]:
111111
ctgt = self.ixd.read_xml_call_target(ctinfo)
112112
fintf = self.ixd.read_xml_function_interface(ctinfo)
113113
fsem = self.ixd.read_xml_function_semantics(ctinfo)
114-
lhsname = ctinfo.get("lhs", None)
115114
self._calltargetinfos[xaddr] = CallTargetInfo(
116-
ctgt, fintf, fsem, lhsname)
115+
ctgt, fintf, fsem)
117116
return self._calltargetinfos
118117

119118
@property
120119
def lhs_names(self) -> Dict[str, str]:
121120
result: Dict[str, str] = {}
122121
for (iaddr, ctinfo) in self.calltargetinfos.items():
123-
if ctinfo.lhsname is not None:
124-
result[iaddr] = ctinfo.lhsname
122+
result[iaddr] = "rtn_" + ctinfo.calltarget.name
125123
return result
126124

127125
@property

chb/invariants/XXprUtil.py

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,12 @@ def vargument_deref_value_to_ast_lval_expression(
458458
foffset = astree.mk_field_offset(field.fieldname, compkey)
459459
return astree.mk_memref_expr(xinitarg, offset = foffset)
460460

461+
elif tgttype.is_pointer:
462+
tgttgttype = cast(AST.ASTTypPtr, tgttype).tgttyp
463+
if coff == 0:
464+
return astree.mk_memref_expr(xinitarg)
465+
466+
461467
chklogger.logger.error(
462468
"AST conversion of argument deref value: %s not yet handled at %s",
463469
str(basevar), iaddr)
@@ -607,17 +613,17 @@ def xvariable_to_ast_def_lval_expression(
607613
return global_variable_to_lval_expression(
608614
memvar.offset, xdata, iaddr, astree)
609615

610-
if xvar.is_memory_variable:
611-
memvar = cast("VMemoryVariable", xvar.denotation)
612-
return memory_variable_to_lval_expression(
613-
memvar.base, memvar.offset, xdata, iaddr, astree)
614-
615616
if xvar.is_local_stack_variable:
616617
stackvar = cast("VMemoryVariable", xvar.denotation)
617618
offset = stackvar.offset.offsetvalue()
618619
stacklval = astree.mk_stack_variable_lval(offset)
619620
return astree.mk_lval_expr(stacklval)
620621

622+
if xvar.is_memory_variable:
623+
memvar = cast("VMemoryVariable", xvar.denotation)
624+
return memory_variable_to_lval_expression(
625+
memvar.base, memvar.offset, xdata, iaddr, astree)
626+
621627
if xvar.is_memory_address_value:
622628
addr = cast("MemoryAddress", xvar.denotation.auxvar)
623629
name = addr.name
@@ -771,7 +777,7 @@ def default() -> AST.ASTExpr:
771777
astxpr1 = xxpr_to_ast_def_expr(xpr1, xdata, iaddr, astree)
772778
astxpr2 = xxpr_to_ast_def_expr(xpr2, xdata, iaddr, astree)
773779
if operator in [
774-
"plus", "minus", "mult", "band", "lor",
780+
"plus", "minus", "mult", "band", "land", "lor", "bor", "asr",
775781
"lsl", "lsr", "eq", "ne", "gt", "le", "lt", "ge"]:
776782
return astree.mk_binary_expression(operator, astxpr1, astxpr2)
777783
else:
@@ -1402,8 +1408,8 @@ def xmemory_dereference_to_ast_def_expr(
14021408
if not astree.has_compinfo(compkey):
14031409
chklogger.logger.error(
14041410
("Encountered compinfo key without definition in symbol "
1405-
+ " table: %d"),
1406-
compkey)
1411+
+ " table: %d at address %s"),
1412+
compkey, iaddr)
14071413
return astree.mk_memref_expr(hl_addr)
14081414

14091415
compinfo = astree.compinfo(compkey)
@@ -1413,14 +1419,15 @@ def xmemory_dereference_to_ast_def_expr(
14131419
hl_addr = cast(AST.ASTBinaryOp, hl_addr)
14141420
if not hl_addr.op == "plus":
14151421
chklogger.logger.error(
1416-
"Encountered address expression with op %s",
1417-
hl_addr.op)
1422+
"Encountered address expression with op %s at address %s",
1423+
hl_addr.op, iaddr)
14181424
return astree.mk_memref_expr(hl_addr)
14191425

14201426
if not hl_addr.exp2.is_integer_constant:
14211427
chklogger.logger.warning(
1422-
"Non-constant field offset not yet supported: %s",
1423-
str(hl_addr.exp2))
1428+
"Non-constant field offset not yet supported: %s "
1429+
+ "at address %s",
1430+
str(hl_addr.exp2), iaddr)
14241431
return astree.mk_memref_expr(hl_addr)
14251432

14261433
fieldoffset = cast(AST.ASTIntegerConstant, hl_addr.exp2).cvalue
@@ -1435,8 +1442,8 @@ def xmemory_dereference_to_ast_def_expr(
14351442
return astree.mk_memref_expr(baseaddr, offset = foffset)
14361443

14371444
chklogger.logger.warning(
1438-
"Unexpected type for address in memory dereference: %s",
1439-
str(hl_addr_type))
1445+
"Unexpected type for address in memory dereference: %s at address %s",
1446+
str(hl_addr_type), iaddr)
14401447
return astree.mk_memref_expr(hl_addr)
14411448

14421449

chb/summaries/bchsummaries.jar

8.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)