Published September 21, 2022 | Version 2.0.0
Software Open


  • 1. Imperial College London
  • 2. Université Rennes 1, IRISA


CompCert GSA

This repository contains the implementation of Gated-SSA in CompCertSSA.


GSA semantics

  • ./midend/GSA.v: Syntax and semantics for GSA.

Generation of GSA

  • ./midend/GSAvalid.v: Translation from SSA to GSA.
  • ./midend/GSAvalidspec.v: Specification of translation.
  • ./midend/GSAvalidproof.v: Proof of semantics preservation for translation.
  • ./midend/GSApredicate.v: The implementation of three-valued logic predicates.
  • ./midend/GSApaths.v: Implementation of Tarjan’s path algorithm.
  • ./midend/RTLloopgen.v, ./midend/RTLloopgenproof.v: Loop normalisation using noops.
  • ./midend/GSAcommon.v: Common shared proofs and definitions.
  • ./midend/GSASat.v: A fallback implementation of a SAT solver.

SMTCoq integration

  • ./midend/GSAhashtree.v: Hashing used to implement sharing of formulas and atoms for SMTCoq.
  • ./midend/GSAsmtpredicate.v: Solving three-valued logic predicates using an SMT solver through SMTCoq.

Building GSA


  • Coq 8.13.2
  • veriT: This exact version is needed: To install : - untar the archive - launch ./configure script and check that it succeeds - launch make. Some versions of clang might fail, in which case you need to add the -Wno-implicit-function-declaration option to it. This can be done by editing Makefile.config - add the veriT executable to your path.
  • Ocaml dependencies: menhir, num (v.1.4), zarith (v.1.12).


First build SMTCoq:

cd smtcoq/src
make -j7
cd extraction
make  # Important: not parallel

Then build CompCertGSA, as you would build CompCert

cd ../../..  # or back to root directory
./configure [your-architecture] # we only support the x86 backend (e.g. x86_64-linux)
make -j7

Compiling with GSA

The GSA intermediate representation can be enabled with -ssa gsa. Then, the GSA representation can be printed out using -dgsa, or the GSA will be translated back to SSA and finally compiled to an executable.

If there are linktime errors, the CompCert library might have to be included with -L./runtime for example.

The following command is expected to finish in around 20s.

./ccomp -ssa gsa -dgsa ./test/c/qsort.c

The GSA representation will then be available as qsort.gsa.0.


Files (4.0 MB)

Name Size Download all
4.0 MB Download