Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Specification fix: ensure that the initial thread can be referenced #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ The following information should additionally be available in the witness:

| key | Meaning | Allowed in Violation Witnesses | Allowed in Correctness Witnesses |
| --- | --- | ---- | ---- |
| threadId | Represents the currently active thread for the transition. If no ``threadId`` is given, any thread can be active. The value should be a unique identififer for a thread. | Yes | Yes |
| createThread | The currently active thread (value of ``threadId``) creates a new thread (value of ``createThread``) . In general, using a ``threadId`` is only allowed after creating a matching thread. The new thread's function can be entered on a second transition following this transition, such that the transition with the ``enterFunction`` key has the ``threadId`` of the created thread. When the function of the thread is exited, the thread is assumed to be terminated and its ``threadId`` should no longer be used. | Yes | Yes |
| threadId | Represents the currently active thread for the transition. The initially active thread has id ``0``. If no ``threadId`` is given, any thread can be active. The value should be a unique identififer for a thread. | Yes | Yes |
| createThread | The currently active thread (value of ``threadId``) creates a new thread (value of ``createThread``) . In general, using a ``threadId`` is only allowed after creating a matching thread, except for thread ``0``, which exits by virtue of starting the program. The new thread's function can be entered on a second transition following this transition, such that the transition with the ``enterFunction`` key has the ``threadId`` of the created thread. When the function of the thread is exited, the thread is assumed to be terminated and its ``threadId`` should no longer be used. | Yes | Yes |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand "which exits by virtue of starting the program".
Did you mean "exists"?


CPAchecker partially supports the validation of violation witnesses for concurrent programs.
This witness specification and the validator are a work in progress and will be subject to modifications.
Expand Down
15 changes: 6 additions & 9 deletions lint/witnesslint/linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def __init__(self, witness, program, options):
self.correctness_witness_only = set()
self.check_existence_later = set()
self.check_later = []
self.witness.threads['0'] = None

def collect_program_info(self, program):
"""
Expand Down Expand Up @@ -439,15 +440,11 @@ def handle_edge_data(self, data, key, parent):
break
self.check_functionname(data.text, data.sourceline)
elif key == witness.THREADID:
# Check disabled for SV-COMP'21 as questions about the specification
# need to be resolved first, see
# https://gitlab.com/sosy-lab/sv-comp/archives-2021/-/issues/30
# if data.text not in self.witness.threads:
# logging.warning(
# "Thread with id {} doesn't exist".format(data.text),
# data.sourceline,
# )
pass
if data.text not in self.witness.threads:
logging.warning(
"Thread with id {} doesn't exist".format(data.text),
data.sourceline,
)
elif key == witness.CREATETHREAD:
if data.text in self.witness.threads:
logging.warning(
Expand Down