CCOMP(1)

NAME
ccomp - the CompCert C compiler

SYNOPSIS
ccomp [options] file ...

DESCRIPTION
CompCert C is a compiler for the C programming language. Its intended use is the compilation of life-critical and mission-critical software written in C and meeting high levels of assurance. It accepts most of the ISO C 99 language, with some exceptions and a few extensions. It produces machine code for the PowerPC (32bit), ARM (32bit), AArch64 (ARM 64bit), x86 (32bit and 64bit), and RISC-V (32bit and 64bit) architectures.

What sets CompCert C apart from any other production compiler, is that it is formally verified, using machine-assisted mathematical proofs, to be exempt from miscompilation issues. In other words, the executable code it produces is proved to behave exactly as specified by the semantics of the source C program. This level of confidence in the correctness of the compilation process is unprecedented and contributes to meeting the highest levels of software assurance. In particular, using the CompCert C compiler is a natural complement to applying formal verification techniques (static analysis, program proof, model checking) at the source code level: the correctness proof of CompCert C guarantees that all safety properties verified on the source code automatically hold as well for the generated executable.

RECOGNIZED SOURCE FILES

.c  C source file.

.i, .p
    C source file that should not be preprocessed.

.s  Assembly file.

.S  Assembly file that must be preprocessed.

.o  Object file.

.a  Library file.

OPTIONS

  General Options

-conf <file>
    Read CompCert configuration from <file>. This takes precedence over any other specification.

-target <triple>
    Read CompCert configuration from <triple>.ini instead of using the default of compcert.ini. The configuration file is searched for in the share directory of the CompCert installation.

  Toolchain Options (PowerPC with Diab Backend)

-t <tof>:<env>
    Select target for Diab toolchain. The option is forwarded to the Diab toolchain and has no effect on the code generated by CompCert. <tof> denotes the target processor, object file format and floating point support. <env> denotes the execution environment.

  Processing Options

-c  Compile to object file only (no linking), result in <file>.o.

-E  Preprocess only, send result to standard output.

-S  Compile to assembly only, save result in <file>.s.

-o <file>
    Generate output to <file>.

  Preprocessing Options

-I<dir>
    Add <dir> to search path for include files.

-include <file>
    Process <file> as if #include "<file>" appears at the first line of the primary source file.

-D<symbol>=<value>
    Define a preprocessor symbol.

-U<symbol>
    Undefine a preprocessor symbol.

-Wp,<args>
    Pass comma separated arguments in <args> to the preprocessor.

-Xpreprocessor <arg>
    Pass argument <arg> to the preprocessor.

-C, -CC, -idirafter, -imacros, -iquote, -isystem, -M, -MF, -MG, -MM, -MP, -MQ, -MT, -nostdinc, -P
    For GNU backends these options are recognized by CompCert and passed through to the preprocessor.

  Optimization Options

-O  Optimize the compiled code. Enabled by default.

-O0 Turn off most optimizations. Synonymous to -fno-const-prop -fno-cse -fno-if-conversion -fno-inline -fno-redundancy -fno-tailcalls.

-O1, -O2, -O3
    Synonymous for -O.

-Os Optimize for code size in preference to code speed.

-Obranchless
    Optimize to generate fewer conditional branches and use branch-free instruction sequences instead. When -fif-conversion is enabled, the conversion is peformed aggressively even if the resulting code is less performant.

-fconst-prop, -fno-const-prop
    Turn on/off global constant propagation. Enabled by default.

-fcse, -fno-cse
    Turn on/off common subexpression elimination. Enabled by default.

-fif-conversion, -fno-if-conversion
    Turn on/off generation of conditional moves. Enabled by default.

-finline, -fno-inline
    Turn on/off inlining of functions. Enabled by default.

-finline-functions-called-once, -fno-inline-functions-called-once
    Turn on/off inlining of functions only required by a single caller. Enabled by default.

-fredundancy, -fno-redundancy
    Turn on/off redundancy elimination. Enabled by default.

-ftailcalls, -fno-tailcalls
    Turn on/off optimization of function calls in tail position. Enabled by default.

-ffloat-const-prop <n>
    Control constant propagation of floats (<n>=0: none, <n>=1: limited, <n>=2: full). Default is full constant propagation.

  Code Generation Options

-falign-functions <n>
    Set alignment of function entry points to <n> bytes. The default alignment is 16 bytes for x86 targets and 4 bytes for ARM and PowerPC.

-fcommon, -fno-common
    Turn on/off placement of global variables defined without an initializer (tentative definitions) in the common section. Disabling the use of the common section inhibits merging of tentative definitions by the linker and may lead to multiple-definition errors. Enabled by default.

-ffpu, -fno-fpu
    Turn on/off use of FP registers for some integer operations. Enabled by default.

  Code Generation Options (PowerPC)

-falign-branch-targets <n>
    Set alignment of branch targets to <n> bytes. By default alignment of branch targets is deactivated.

-falign-cond-branches <n>
    Set alignment of conditional branch instructions to <n> bytes. By default alignment of conditional branches is deactivated.

  Code Generation Options (PowerPC with Diab Backend)

-fsmall-const <n>
    Set maximal size for allocation in small data constant to <n> bytes. The default is 8 bytes.

-fsmall-data <n>
    Set maximal size for allocation in small data area to <n> bytes. The default is 8 bytes.

  Code Generation Options (ARM Targets)

-mthumb
    Generate code using the Thumb 2 instruction encoding. This is the default if CompCert is configured for the ARMv7R profile.

-marm
    Generate code using the ARM instruction encoding. This is the default if CompCert is configured for a profile other than ARMv7R.

  Assembling Options

-Wa,<args>
    Pass comma separated arguments in <args> to the assembler.

-Xassembler <arg>
    Pass argument <arg> to the assembler.

  Debugging Options

-g  Generate full debugging information.

-g0, -g1, -g2, -g3
    Control generation of debugging information (0: none, 1: only globals, 2: globals and locals without locations, 3: full debug information). The default level is 3 for full debug information.

  Debugging Options (GNU Backend)

-gdwarf-<n>
    For GNU backends select debug information in DWARF format version 2 or 3. The default format is DWARF v3.

  Linking Options

-l<library>
    Link library <library>.

-L<dir>
    Add <dir> to search path for libraries.

-Wl,<args>
    Pass comma separated arguments in <args> to the linker.

-WUl,<args>
    Pass comma separated arguments in <args> to the driver program used for linking.

-Xlinker <arg>
    Pass argument <arg> to the linker.

-s  Remove all symbol table and relocation information from the executable.

-static
    Prevent linking with the shared libraries.

-T <file>
    Use <file> as linker command file.

-u <symbol>
    Pretend the symbol <symbol> is undefined to force linking of library modules to define it.

-nodefaultlibs, -nostartfiles, -nostdlib
    For GNU backends these options are recognized by CompCert and passed through to the linker.

  Language Support Options

-flongdouble, -fno-longdouble
    Turn on/off support for emulation of long double as double. Disabled by default.

-fpacked-structs, -fno-packed-structs
    Turn on/off support for emulation of packed structs. Disabled by default.

-fstruct-passing, -fno-struct-passing
    Turn on/off support for passing structs and unions by value as function results or function arguments. Disabled by default.

-funprototyped, -fno-unprototyped
    Turn on/off support calls to old-style functions without prototypes. Enabled by default.

-fvararg-calls, -fno-vararg-calls
    Turn on/off support for calls to variable-argument functions. Enabled by default.

-finline-asm, -fno-inline-asm
    Turn on/off support for inline asm statements. Disabled by default.

-fall
    Activate all language support options above.

-fnone
    Deactivate all language support options above.

  Diagnostic Options

-Wall
    Enable all warnings.

-W<warning>
    Enable the specific warning <warning>. CompCert supports the following warning classes:

    c11-extensions: Feature specific to C11. Disabled by default.

    compare-distinct-pointer-types: Comparison of different pointer types. Enabled by default.

    compcert-conformance: Features that are not part of the CompCert C core language, e.g. K&R style functions. Disabled by default.

    constant-conversion: Dangerous conversion of constants, e.g. literals that are too large for the given type. Enabled by default.

    extern-after-definition: Extern declarations after non-extern definitions. Enabled by default.

    flexible-array-extensions: Use of structs with flexible arrays nexted within structs or arrays. Disabled by default.

    gnu-empty-struct: GNU extension for empty structs. Enabled by default.

    ignored-attributes: Attribute declarations after definitions. Enabled by default.

    implicit-function-declaration: Deprecated implicit function declarations. Enabled by default.

    implicit-int: Type of parameter or return type is implicitly assumed to be int. Enabled by default.

    inline-asm-sdump: Use of unsupported features in combination with dump of abstract syntax tree. Enabled by default.

    int-conversion: Conversion between pointer and integer. Enabled by default.

    invalid-noreturn: Functions declared as noreturn that actually contain a return statement. Enabled by default.

    literal-range: Floating point literals with out-of-range magnitudes or values that convert to NaN. Enabled by default.

    main-return-type: Wrong return type for main. Enabled by default.

    missing-declarations: Declarations which do not declare anything. Enabled by default.

    non-linear-cond-expr: Conditional expression that may not be optimized to branchless code. Only issued in -Obranchless mode. Disabled by default.

    pointer-type-mismatch: Use of incompatible pointer types in conditional expressions. Enabled by default.

    reduced-alignment: Alignment specifications lower than natural alignment. Disabled by default.

    return-type: Void-return statement in non-void function. Enabled by default.

    static-in-inline: Use of static variables in non-static inline functions. Enabled by default.

    tentative-incomplete-static: Use of tentative static definitions with incomplete type. Disabled by default.

    unknown-attributes: Use of unsupported or unknown attributes. Enabled by default.

    unknown-pragmas: Use of unsupported or unknown pragmas. Disabled by default.

    unused-ais-parameter: Unused parameter for embedded program annotations. Disabled by default.

    unused-variable: Unused local variables. Disabled by default.

    varargs: Promotable vararg arguments. Enabled by default.

    wrong-ais-parameter: Use of illegal parameter expressions for embedded program annotations. Enabled by default.

    zero-length-array: GNU extension for zero length arrays. Disabled by default.

-Wno-<warning>
    Disable the specific warning <warning>.

-w  Suppress all warnings.

-Werror
    Treat all warnings of CompCert as errors.

-Werror=<warning>
    Treat the specific warning <warning> as an error.

-Wno-error=<warning>
    Prevent the specific warning <warning> from being treated as error even if -Werror is specified.

-Wfatal-errors
    Treat all errors of CompCert as fatal errors, so that the compilation is aborted immediately.

-fmax-errors=<n>
    Print at most <n> error messages before bailing out. Defaults to <n>=0 which means unlimited error messages.

-fdiagnostics-format=<format>
    Select format for location information in messages. Possible formats are ccomp (default), msvc or vi.

-fdiagnostics-color, -fno-diagnostics-color
    Turn on/off colored diagnostics. Enabled by default for TTY output devices.

-fdiagnostics-show-option, -fno-diagnostics-show-option
    Turn on/off printing of option name with mappable diagnostics. Enabled by default.

  Tracing Options

-dprepro
    Save C file after preprocessing in <file>.i

-dparse
    Save C file after parsing and elaboration in <file>.parsed.c.

-dc Save generated CompCert C in <file>.compcert.c.

-dclight
    Save generated Clight in <file>.light.c.

-dcminor
    Save generated Cminor in <file>.cm.

-drtl
    Save RTL at various optimization points in <file>.rtl.<n>.

-dltl
    Save LTL after register allocation in <file>.ltl.

-dmach
    Save generated Mach code in <file>.mach.

-dasm
    Save generated assembly in <file>.s.

-dall
    Save all generated intermediate files in <file>.<ext>.

-sdump
    Save abstract syntax tree of generated assembly for post-linking validation tool in <file>.json.

  Miscellaneous Options

-stdlib <dir>
    Set the path of the CompCert run-time library to <dir>.

-v  Print external commands before invoking them.

-timings
    Print information about the time spent in various compiler passes.

-version
    Print the CompCert version information and exit.

@<file>
    Read command line options from <file>.

  Interpreter Mode

-interp
    Execute the given .c files using the reference interpreter.

-quiet
    Suppress diagnostic messages for the interpreter.

-trace
    Have the interpreter produce a detailed trace of reductions.

-random
    Randomize execution order.

-all
    Simulate all possible execution orders.

ENVIRONMENT

COMPCERT_CONFIG
    If this environment variable is present, it denotes the path to the CompCert configuration file to be used. The variable takes precedence over default search paths or the -target option, but has a lower priority than the -conf option.

BUGS
To report bugs, please visit <https://github.com/AbsInt/CompCert/issues>.