Published January 14, 2015 | Version v1
Journal article Open

Common compiler optimisations are invalid in the C11 memory model and what we can do about it

Description

We show that the weak memory model introduced by the 2011 C and C++ standards does not permit many common source-to-source program transformations (such as expression linearisation and “roach motel” reorderings) that modern compilers perform and that are deemed to be correct. As such it cannot be used to define the semantics of intermediate languages of compilers, as, for instance, LLVM aimed to. We consider a number of possible local fixes, some strengthening and some weakening the model. We evaluate the proposed fixes by determining which program transformations are valid with respect to each of the patched models. We provide formal Coq proofs of their correctness or counterexamples as appropriate.

Files

article.pdf

Files (458.1 kB)

Name Size Download all
md5:610311470a1c3c15fde50d1868bcb817
458.1 kB Preview Download