A Formal Semantics of C with OpenMP Parallelism

📅 2026-05-26
📈 Citations: 0
Influential: 0
📄 PDF
🤖 AI Summary
This work addresses the semantic ambiguity of OpenMP directives in C programs, which often leads to logical errors and data races. For the first time, it develops a formal operational semantics for C extended with OpenMP annotations, building upon the formally verified CompCert C semantics and its concurrent extension. The proposed semantics precisely captures the intricate interactions between OpenMP constructs and program state, uncovering critical behaviors obscured by prior informal descriptions. By rigorously defining the execution model, the framework guarantees that all well-formed executions are free from data races, thereby establishing a solid theoretical foundation for detecting undefined behaviors arising from incorrect OpenMP annotations.
📝 Abstract
OpenMP is a popular parallelization framework that lets users transform sequential code into parallel code with a few simple annotations. Unfortunately, it is also easy to inadvertently introduce errors by adding OpenMP pragmas into otherwise correct programs, including both logic errors and race conditions. We present a formal semantics for C code with OpenMP directives, building on the C semantics of the CompCert verified compiler and its extension to concurrency. Our semantics captures subtle interactions between OpenMP directives and variable state that have been obscured by previous OpenMP semantics, and provides a basis for detecting undesired behaviors introduced by incorrect annotations: in particular, any successful execution is guaranteed to be free of data races.
Problem

Research questions and friction points this paper is trying to address.

OpenMP
data races
parallelization
formal semantics
C language
Innovation

Methods, ideas, or system contributions that make the work stand out.

formal semantics
OpenMP
data race freedom
CompCert
parallel C
🔎 Similar Papers
No similar papers found.