Skip to content

Commit aa6ab85

Browse files
committed
Merge remote-tracking branch 'origin/master' into abakst/errno
2 parents e5a15d0 + 3ef0cb4 commit aa6ab85

24 files changed

Lines changed: 7325 additions & 6265 deletions

File tree

chc/app/CExp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def accept(self, visitor: "CVisitor") -> None:
730730
visitor.visit_startof(self)
731731

732732
def __str__(self) -> str:
733-
return "&(" + str(self.lval) + ")"
733+
return "&s(" + str(self.lval) + ")"
734734

735735

736736
@cdregistry.register_tag("fnapp", CExp)

chc/app/CHVersion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
chcversion: str = "0.2.0-2025-12-06"
1+
chcversion: str = "0.2.0-2026-02-26"

chc/app/CLval.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# Copyright (c) 2017-2020 Kestrel Technology LLC
88
# Copyright (c) 2020-2022 Henny B. Sipma
9-
# Copyright (c) 2023-2025 Aarno Labs LLC
9+
# Copyright (c) 2023-2026 Aarno Labs LLC
1010
#
1111
# Permission is hereby granted, free of charge, to any person obtaining a copy
1212
# of this software and associated documentation files (the "Software"), to deal
@@ -28,15 +28,15 @@
2828
# ------------------------------------------------------------------------------
2929
"""Left-hand side value."""
3030

31-
from typing import Dict, List, Tuple, TYPE_CHECKING
31+
from typing import cast, Dict, List, Tuple, TYPE_CHECKING
3232

3333
from chc.app.CDictionaryRecord import CDictionaryRecord
3434

3535
import chc.util.IndexedTable as IT
3636

3737
if TYPE_CHECKING:
3838
from chc.app.CDictionary import CDictionary
39-
from chc.app.CLHost import CLHost
39+
from chc.app.CLHost import CLHost, CLHostMem
4040
from chc.app.COffset import COffset
4141
from chc.app.CVisitor import CVisitor
4242

@@ -94,4 +94,11 @@ def accept(self, visitor: "CVisitor") -> None:
9494
visitor.visit_lval(self)
9595

9696
def __str__(self) -> str:
97-
return str(self.lhost) + str(self.offset)
97+
if self.lhost.is_mem:
98+
if self.offset.is_no_offset or self.offset.is_field:
99+
return str(self.lhost) + str(self.offset)
100+
else:
101+
lhost = cast("CLHostMem", self.lhost)
102+
return "(" + str(lhost.exp) + ")" + str(self.offset)
103+
else:
104+
return str(self.lhost) + str(self.offset)

chc/cmdline/AnalysisManager.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# Copyright (c) 2017-2020 Kestrel Technology LLC
88
# Copyright (c) 2020-2022 Henny Sipma
9-
# Copyright (c) 2023-2024 Aarno Labs LLC
9+
# Copyright (c) 2023-2026 Aarno Labs LLC
1010
#
1111
# Permission is hereby granted, free of charge, to any person obtaining a copy
1212
# of this software and associated documentation files (the "Software"), to deal
@@ -237,7 +237,7 @@ def create_file_primary_proofobligations(
237237
print_status(self.targetpath)
238238
result = subprocess.call(
239239
cmd, cwd=self.targetpath, stderr=subprocess.STDOUT)
240-
print("\nResult: " + str(result))
240+
print_status("\nResult: " + str(result))
241241
else:
242242
result = subprocess.call(
243243
cmd,
@@ -293,7 +293,7 @@ def f(cfile: "CFile") -> None:
293293
self.capp.iter_files(f)
294294

295295
def _generate_and_check_file_cmd_partial(
296-
self, cfilepath: Optional[str], domains: str) -> List[str]:
296+
self, cfilepath: Optional[str], domains: str, iteration: int) -> List[str]:
297297
cmd: List[str] = [
298298
self.canalyzer,
299299
"-summaries",
@@ -309,6 +309,7 @@ def _generate_and_check_file_cmd_partial(
309309
if not (self.contractpath is None):
310310
cmd.extend(["-contractpath", self.contractpath])
311311
cmd.extend(["-projectname", self.capp.projectname])
312+
cmd.extend(["-iteration", str(iteration)])
312313
if self.keep_system_includes:
313314
cmd.append("-keep_system_includes")
314315
if self.wordsize > 0:
@@ -331,27 +332,28 @@ def generate_and_check_file(
331332
self,
332333
cfilename: str,
333334
cfilepath: Optional[str],
334-
domains: str) -> None:
335+
domains: str,
336+
iteration: int) -> None:
335337
"""Generate invariants and check proof obligations for a single file."""
336338

337339
try:
338-
cmd = self._generate_and_check_file_cmd_partial(cfilepath, domains)
340+
cmd = self._generate_and_check_file_cmd_partial(cfilepath, domains, iteration)
339341
cmd.append(cfilename)
340342
chklogger.logger.info(
341343
"Calling AI to generate invariants: %s",
342344
" ".join(cmd))
343345
if self.verbose:
344346
result = subprocess.call(
345347
cmd, cwd=self.targetpath, stderr=subprocess.STDOUT)
346-
print("\nResult: " + str(result))
348+
print_status("\nResult: " + str(result))
347349
else:
348350
result = subprocess.call(
349351
cmd,
350352
cwd=self.targetpath,
351353
stdout=open(os.devnull, "w"),
352354
stderr=subprocess.STDOUT,
353355
)
354-
print("\nResult: " + str(result))
356+
print_status("\nGenerate-and-check: result: " + str(result))
355357
if result != 0:
356358
chklogger.logger.error(
357359
"Error in generating invariants for %s", cfilename)
@@ -361,14 +363,14 @@ def generate_and_check_file(
361363
print(args)
362364
exit(1)
363365

364-
def generate_and_check_app(self, domains: str, processes: int = 1) -> None:
366+
def generate_and_check_app(self, domains: str, iteration: int, processes: int = 1) -> None:
365367
"""Generate invariants and check proof obligations for application."""
366368

367369
if processes > 1:
368370

369371
def f(cfile: "CFile") -> None:
370372
cmd = self._generate_and_check_file_cmd_partial(
371-
cfile.cfilepath, domains)
373+
cfile.cfilepath, domains, iteration)
372374
cmd.append(cfile.cfilename)
373375
self._execute_cmd(cmd)
374376

@@ -377,7 +379,7 @@ def f(cfile: "CFile") -> None:
377379

378380
def f(cfile: "CFile") -> None:
379381
self.generate_and_check_file(
380-
cfile.cfilename, cfile.cfilepath, domains)
382+
cfile.cfilename, cfile.cfilepath, domains, iteration)
381383

382384
self.capp.iter_files(f)
383385
self.capp.iter_files(self.reset_tables)

chc/cmdline/c_file/cfileutil.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -569,13 +569,13 @@ def cfile_analyze_file(args: argparse.Namespace) -> NoReturn:
569569
am.reset_tables(cfile)
570570
capp.collect_post_assumes()
571571

572-
am.generate_and_check_file(cfilename, None, analysisdomains)
572+
am.generate_and_check_file(cfilename, None, analysisdomains, 0)
573573
am.reset_tables(cfile)
574574
capp.collect_post_assumes()
575575

576576
for k in range(5):
577577
capp.update_spos()
578-
am.generate_and_check_file(cfilename, None, analysisdomains)
578+
am.generate_and_check_file(cfilename, None, analysisdomains, k + 1)
579579
am.reset_tables(cfile)
580580

581581
chklogger.logger.info("cfile analyze completed")
@@ -803,13 +803,13 @@ def cfile_run_file(args: argparse.Namespace) -> NoReturn:
803803
am.reset_tables(cfile)
804804
capp.collect_post_assumes()
805805

806-
am.generate_and_check_file(cfilename, None, analysisdomains)
806+
am.generate_and_check_file(cfilename, None, analysisdomains, 0)
807807
am.reset_tables(cfile)
808808
capp.collect_post_assumes()
809809

810810
for k in range(5):
811811
capp.update_spos()
812-
am.generate_and_check_file(cfilename, None, analysisdomains)
812+
am.generate_and_check_file(cfilename, None, analysisdomains, k + 1)
813813
am.reset_tables(cfile)
814814

815815
chklogger.logger.info("cfile analyze completed")
@@ -1073,13 +1073,13 @@ def cfile_testlibc_summary(args: argparse.Namespace) -> NoReturn:
10731073
am.reset_tables(cfile)
10741074
capp.collect_post_assumes()
10751075

1076-
am.generate_and_check_file(cfilename, None, "llrvisp")
1076+
am.generate_and_check_file(cfilename, None, "llrvisp", 0)
10771077
am.reset_tables(cfile)
10781078
capp.collect_post_assumes()
10791079

10801080
for k in range(5):
10811081
capp.update_spos()
1082-
am.generate_and_check_file(cfilename, None, "llrvisp")
1082+
am.generate_and_check_file(cfilename, None, "llrvisp", k + 1)
10831083
am.reset_tables(cfile)
10841084

10851085
chklogger.logger.info("cfile analyze completed")

chc/cmdline/c_project/cprojectutil.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------------------------------------------------
55
# The MIT License (MIT)
66
#
7-
# Copyright (c) 2024-2025 Aarno Labs, LLC
7+
# Copyright (c) 2024-2026 Aarno Labs, LLC
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -577,7 +577,7 @@ def check_continuation() -> int:
577577

578578
if exitcode == 0:
579579
for i in range(1):
580-
am.generate_and_check_app(analysisdomains, processes=maxprocesses)
580+
am.generate_and_check_app(analysisdomains, 0, processes=maxprocesses)
581581
capp.reinitialize_tables()
582582
capp.update_spos()
583583

@@ -586,7 +586,7 @@ def check_continuation() -> int:
586586
if exitcode == 0:
587587
for i in range(5):
588588
capp.update_spos()
589-
am.generate_and_check_app(analysisdomains, processes=maxprocesses)
589+
am.generate_and_check_app(analysisdomains, i + 1, processes=maxprocesses)
590590
capp.reinitialize_tables()
591591

592592
exitcode = check_continuation()

chc/cmdline/jsonresultutil.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------------------------------------------------
55
# The MIT License (MIT)
66
#
7-
# Copyright (c) 2024 Aarno Labs LLC
7+
# Copyright (c) 2024-2026 Aarno Labs LLC
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -203,12 +203,12 @@ def ppo_to_json_result(po: "CFunctionPO") -> JSONResult:
203203
content["predicate"] = str(po.predicate)
204204
content["context"] = programcontext_to_json_result(po.context).content
205205
if po.is_closed:
206-
content["expl"] = po.explanation
206+
content["expl"] = po.explanation_txt
207207
else:
208208
if po.has_diagnostic():
209-
content["argdiagnostics"] = po.diagnostic.argument_msgs
209+
content["argdiagnostics"] = po.diagnostic.argument_msgs_txt
210210
content["keydiagnostics"] = po.diagnostic.keyword_msgs
211-
content["msgdiagnostics"] = po.diagnostic.msgs
211+
content["msgdiagnostics"] = po.diagnostic.msgs_txt
212212
return JSONResult("ppo", content, "ok")
213213

214214

chc/cmdline/juliet/julietutil.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# ------------------------------------------------------------------------------
55
# The MIT License (MIT)
66
#
7-
# Copyright (c) 2024 Aarno Labs, LLC
7+
# Copyright (c) 2024-2026 Aarno Labs, LLC
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a copy
1010
# of this software and associated documentation files (the "Software"), to deal
@@ -381,13 +381,13 @@ def save_xrefs(f: "CFile") -> None:
381381
exit(1)
382382

383383
for i in range(1):
384-
am.generate_and_check_app("llrvisp", processes=jmaxproc)
384+
am.generate_and_check_app("llrvisp", 0, processes=jmaxproc)
385385
capp.reinitialize_tables()
386386
capp.update_spos()
387387

388388
for i in range(5):
389389
capp.update_spos()
390-
am.generate_and_check_app("llrvisp", processes=jmaxproc)
390+
am.generate_and_check_app("llrvisp", i + 1, processes=jmaxproc)
391391
capp.reinitialize_tables()
392392

393393
def filefilter(filename: str) -> bool:

chc/cmdline/kendra/TestManager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# Copyright (c) 2017-2020 Kestrel Technology LLC
88
# Copyright (c) 2020-2022 Henny B. Sipma
9-
# Copyright (c) 2023-2024 Aarno Labs LLC
9+
# Copyright (c) 2023-2026 Aarno Labs LLC
1010
#
1111
# Permission is hereby granted, free of charge, to any person obtaining a copy
1212
# of this software and associated documentation files (the "Software"), to deal
@@ -591,7 +591,7 @@ def test_ppo_proofs(self, delaytest: bool = False) -> None:
591591
for d in creffile.domains:
592592
am = AnalysisManager(
593593
capp, verbose=self.verbose, disable_timing=True)
594-
am.generate_and_check_file(cfilename, None, d)
594+
am.generate_and_check_file(cfilename, None, d, 0)
595595
cfile.reinitialize_tables()
596596
ppos = cfile.get_ppos()
597597
if delaytest:
@@ -672,7 +672,7 @@ def test_spo_proofs(self, delaytest: bool = False) -> None:
672672
for d in creffile.domains:
673673
am = AnalysisManager(
674674
capp, verbose=self.verbose, disable_timing=True)
675-
am.generate_and_check_file(cfilename, None, d)
675+
am.generate_and_check_file(cfilename, None, d, 0)
676676
cappfile.reinitialize_tables()
677677
spos = cappfile.get_spos()
678678
if delaytest:

chc/proof/CFunctionPO.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#
77
# Copyright (c) 2017-2020 Kestrel Technology LLC
88
# Copyright (c) 2020-2022 Henny B. Sipma
9-
# Copyright (c) 2023-2024 Aarno Labs LLC
9+
# Copyright (c) 2023-2026 Aarno Labs LLC
1010
#
1111
# Permission is hereby granted, free of charge, to any person obtaining a copy
1212
# of this software and associated documentation files (the "Software"), to deal
@@ -185,6 +185,16 @@ def has_dependencies(self) -> bool:
185185
def explanation(self) -> Optional["SituatedMsg"]:
186186
return self._explanation
187187

188+
@property
189+
def explanation_txt(self) -> Optional[str]:
190+
"""Returns the text of the explanation message without the additional
191+
details."""
192+
193+
if self.explanation is not None:
194+
return self.explanation.msg
195+
else:
196+
return None
197+
188198
def has_explanation(self) -> bool:
189199
return self._explanation is not None
190200

0 commit comments

Comments
 (0)