-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support atomic types #688
Support atomic types #688
Conversation
I think we should ensure this by adding atomic statements in Boogie. This would also solve the current unsoundness on this branch when using the setting |
Thanks, that's a good point. With this settings, it actually makes a difference, whether we translate to a single Boogie statement |
52f4372
to
25c038d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Thanks for tackling this!
I've left some questions, and we should in particular also support other atomic operations such as +=
etc.
..._freiburg/informatik/ultimate/cdt/translation/implementation/base/CExpressionTranslator.java
Outdated
Show resolved
Hide resolved
..._freiburg/informatik/ultimate/cdt/translation/implementation/base/CExpressionTranslator.java
Outdated
Show resolved
Hide resolved
...de/uni_freiburg/informatik/ultimate/cdt/translation/implementation/base/DataRaceChecker.java
Show resolved
Hide resolved
...or/src/de/uni_freiburg/informatik/ultimate/cdt/translation/implementation/base/CHandler.java
Show resolved
Hide resolved
5535648
to
099552c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Three small questions/requests left, otherwise it looks good. Thanks again for taking care of this feature!
...or/src/de/uni_freiburg/informatik/ultimate/cdt/translation/implementation/base/CHandler.java
Outdated
Show resolved
Hide resolved
...or/src/de/uni_freiburg/informatik/ultimate/cdt/translation/implementation/base/CHandler.java
Outdated
Show resolved
Hide resolved
...or/src/de/uni_freiburg/informatik/ultimate/cdt/translation/implementation/base/CHandler.java
Show resolved
Hide resolved
...ource/Library-BoogieAST/src/de/uni_freiburg/informatik/ultimate/boogie/StatementFactory.java
Show resolved
Hide resolved
...or/src/de/uni_freiburg/informatik/ultimate/cdt/translation/implementation/base/CHandler.java
Outdated
Show resolved
Hide resolved
to create AtomicStatement from a List / Stream of statements. This method also avoid nesting of AtomicStatements (should not make a difference on the CFG, but makes the Boogie code slightly nicer).
This adapts the translation for the following statements/expressions: * reads of heap variables (`MemoryHandler::getReadCall`) * writes of heap variables (`MemoryHandler::getWriteCall`) * writes of non-heap variables (`CHandler::makeAssignment`) * combined read-writes (e.g. `++`, `--`, `*=`, ...) (`CHandler::handleAtomicReadWrite`)
9101591
to
2b3c8f0
Compare
This PR adds support for atomic types (
_Atomic
). To do so, I performed the following steps:__attribute__((atomic))
) for our parser not to crash.CType
. This flag is only set explicitly inCPrimitive
(based on the GCC attribute) and aCNamed
is atomic iff the underlying type is atomic. All other types are currently not atomic. There can be actually an atomic pointer (see here), but we cannot parse the attribute properly at this location and thus don't support atomic pointers.DataRaceChecker
).MemoryHandler::getReadCall
), writes (seeMemoryHandler::getWriteCall
andCHandler::makeAssignment
) and combined read-writes (e.g.++
,--
,*=
, ...) (seeCHandler::makeAtomicAssignmentIfNecessary
) was adapted.