Releases: AbsInt/CompCert
Releases · AbsInt/CompCert
CompCert 3.16
Code generation and optimization
- Extend neededness analysis to 64-bit integer operations, enabling more useless integer computations to be removed.
- Extend common subexpression elimination (CSE) and dead code elimination to calls to known pure built-in functions and to known pure arithmetic helper functions.
- Generation of position-independent code (PIC) for AArch64, RISC-V and x86-64 (option
-fpic) (#551) - Generation of position-independent executables (PIE) for AArch64, RISC-V and x86-64 (option
-fpie) (#551) - RISC-V: use PC-relative addressing instead of absolute addressing where possible (#550)
- PowerPC and x86/ELF: put jump tables in
.rodatasection instead of.textsection (#508)
Bug fixes
- Reject identifiers consisting of a single
$sign. This can cause errors with some assemblers, and is not ISO C. - Remove syntactic support for
[*]array declarators, which was introduced in 3.15 (#539). They are usable only with variable-length arrays, which CompCert doesn't support. - Check that
[static <size>]declarators occur only in function prototypes and only in outermost position, as prescribed by ISO C. - Fix corner case of designated initializers involving union with anonymous members.
- Fix wrong lexing of
#pragmadirectives that immediately follow a//single-line comment. (Affects only non-preprocessed.iinput files; preprocessed.cfiles are not affected.)
Usability
- Added warning
dollar-in-identifier-extensionfor identifiers that contain$signs. (This is not ISO C, just a popular extension.) - Revised handling of unknown warnings:
-W<unknown warning>is now a warning instead of an error;-Wno-<unknown warning>is silently ignored (#554). - Added warning
unknown-warning-option, so that warnings about unknown warnings can be ignored (-Wno-unknown-warning-option) or turned into an error (-Werror=unknown-warning-option) (#554). - Recognize option
-sharedand pass it to the linker. - Recognize options
-pieand-no-pieand pass them to the linker. - Recognize options
-MDand-MMDand pass them to the preprocessor. - On BSD platforms, use
ccinstead ofgccas the default preprocessor and linker. - On BSD platforms, add
-z nobtcfilinker option. (This turns IBT/BTI off on OpenBSD, until it is properly supported by CompCert.)
Rocq/Coq development
CompCert 3.15
C language support
- Minimal syntactic support for
_Float16type (half-precision FP numbers). Function declarations using_Float16are correctly parsed, but any actual use of_Float16is rejected later during compilation. (#525) - Support C99 array declarator syntax involving
staticand*. These annotations are correctly parsed, but ignored during typing and compilation. (#539)
Code generation and optimization
- Better support for
_Booltype in the back-end and in the memory model.
This avoids redundant normalizations to_Bool. - Take types of function parameters into account during value analysis.
This avoids redundant normalizations on parameters of small integer types. - More conservative static analysis of pointer comparisons. (#516)
- Refined heuristic for if-conversion. Turn if-conversion off in some cases where it would prevent later optimization of conditional branches in the continuation of the
if. - CSE: remember pointer alias information in
Loadequations, making it possible to remove more redundant memory loads. (#518) - More precise value analysis of integer multiplication, division, modulus.
- Constant propagation: optimize "known integer or undefined" results. For example,
&x == &x, which is either 1 or undefined, is now replaced by 1. - Optimize
(x ^ cst) != 0intox != cst. - Avoid quadratic compile-time behavior on deeply-nested
ifstatements. (#519)
Bug fixes
- More robust determination of symbols that may be defined in a shared object. (#538)
- Escape
$NNNidentifiers in generated x86 and ARM assembly code (#541). - Wrong parameter scoping in function definitions such as
int (*f(int y))(int x) { ... }(a function returning a pointer to a prototyped function).
Usability
- Mark stack as non-executable in binaries produced by
ccomp. - Check that preprocessed sources (
.ifiles) do not contain backslash-newline sequences. ./configure arm-linuxnow selects the hard-FP ABI, since Linux distributions no longer use the soft-FP ABI.
Supporting libraries
- ARM library for 64-bit integer arithmetic: faster division, cleaned-up code.
Coq development
CompCert 3.14
ISO C conformance
freehas well-defined semantics on blocks of size 0 (#509).
Code generation and optimization
- More simplifications of comparison operations and selection operations during the CSE pass.
- Replace selection operations with moves if both branches are equal.
- ARM 32 bits: several minor improvements to the generated code (#503 and more).
Bug fixes
- x86 under Windows: the wrong
subinstruction was generated forPallocframe. - ARM: fix PC displacement overflow involving floating-point constants.
- ARM: fix error on printing of "s17" register.
- RISC-V: do not use 64-bit FP registers for
memcpyif option-fno-fpuis given.
Usability
- Added generation of CFI debugging directives for AArch64 and RISC-V.
- Removed the command-line option
-fstruct-return, deprecated since release 2.6.
Formal semantics
- The big-step semantics for Clight now supports the two models for function arguments (either as stack-allocated variables or as register-like temporaries).
Coq development
- Support Coq 8.17, 8.18, and 8.19.
- Revised most uses of the
intuitiontactic (#496 and more). - Address most other deprecation warnings from Coq 8.18 and 8.19.
- Updated local copy of MenhirLib to version 20231231.
- Updated local copy of Flocq to version 4.1.4.
Distribution
- The small test suite was moved to a separate Git repository. Use
git submodule init && git submodule updateto download it.
CompCert 3.13
Code generation and optimization:
- Slightly more precise value analysis, with a better distinction between "any integer value" and "any integer or pointer value". (#490)
- Recognize a few more nested conditional expressions that can be if-converted into a conditional move.
- Register allocation: better support for "preferred" registers, e.g. registers R0-R3 on ARM Thumb, which enable more compact instruction encodings.
- ARM Thumb: use more instructions that can be encoded in 16 bits, producing more compact code.
- x86: use a shorter instruction encoding for loading unsigned 32-bit constants. (#487)
Bug fixes:
_Noreturnon function definitions (but not declarations) was ignored sometimes.- The argument of
__builtin_va_endwas discarded, is now evaluated for its side effects. - Tail call optimization must be disabled in variadic functions, otherwise a
va_liststructure can get out of scope. - Nested compound initializers were elaborated in the wrong order, causing compile-time failures later in the compilation pipeline.
- The signedness of a bit field was determined differently when its type was an enum type and when it was a typedef to an enum type.
ABI conformance:
- Define
wchar_texactly like the ABI says. On most platforms, CompCert was definingwchar_tassigned int, but it must beunsigned intfor AArch64-ELF andunsigned longfor PowerPC-EABI.
Supported platforms:
- Removed support for Cygwin 32 bits, which has reached end of life. Cygwin 64 bits remains supported.
Coq development:
- Support Coq 8.16.0 and 8.16.1, addressing most of the new warnings in 8.16.
- When installing the Coq development, also install coq-native generated files.
- Tweak some proof scripts for compatibility with future Coq versions. (#465, #470, #491, #492)
- Updated the vendored copy of Flocq to version 4.1.1.
CompCert 3.12
New features:
- Support unstructured
switchstatements such as Duff's device. This is achieved via an optional, unverified code rewrite, activated by option-funstructured-switch. (#459) - Support C11 Unicode string literals and character constants, such as
u8"été"oru32'❎'.
Usability:
- Support the
-std=c99,-std=c11and-std=c18option. These options are passed to the preprocessor, helping it select the
correct version of the standard header files. It also controls CompCert's warning for uses of C11 features. (#456) - The source character set of CompCert is now officially Unicode with UTF-8 encoding, A new warning
invalid-utf8is triggered if byte sequences that are not valid UTF-8 are found outside of comments. Other source character sets and stricter validation can be supported via the-finput-charsetoption, see next. - If the GNU preprocessor is used, the source character set can be selected with the
-finput-charset=option. In particular,-finput-charset=utf8checks that the source file is correctly UTF-8 encoded, and-finput-charset=asciithat it contains no Unicode characters at all. - Support mergeable sections for string literals and for numerical constants.
- AArch64, ARM, RISC-V and x86 ELF targets: use
.data.rel.rosection forconstdata whose initializers contain relocatable addresses. This is required by the LLVM linker and simplifies the work of the GNU linker. configurescript: add option-sharedirto specify where to put thecompcert.iniconfiguration file (#450, #460)- ARM 32 bits: emit appropriate
Tag_ABI_VFPattribute (#461)
Optimizations:
- Recognize more
if-elsestatements that can be if-converted into a conditional move. In particular, debug statements generated in-gmode no longer prevent this conversion.
Bug fixes:
- Revised simplification of nested conditional,
||,&&expressions to make sure the generated Clight code is well typed and is not rejected later byccomp(#458). - In
-gmode, when running under Windows, theccompexecutable could fail on an uncaught exception while inserting lines of the source C file as comments in the generated assembly file. - Reintroduced DWARF debug information for bit fields in structs (it was missing since 3.10).
Coq development:
- RTLgen: use the state and error monad for reserving
gotolabels (#371) (by Pierre Nigron) - Add
Declare Scopestatements where appropriate, and re-enable theundeclared-scopewarning.
CompCert 3.11
New features
- Support
_Genericexpressions from ISO C11.
ISO C conformance
- Enumeration types are compatible only with
intbut not with other integer types. - Fixed confusion between unprototyped function pointer types
T (*)()and prototyped, zero-argument function pointer typesT (*)(void)in type casts (#431).
Usability
- Improved control-flow analysis of calls to "noreturn" functions, resulting in more accurate warnings.
- More detailed warning for unprototyped function definitions, now shows the prototyped type that is given to the function.
- Extended the warning above to definitions of the form
T f() { ... }, i.e. unprototyped but with no parameters. (Before, the warning would trigger only if parameters were declared.) - Check (and warn if requested) for arguments of struct/union types passed to a variable-argument function.
Bug fixes
- RISC-V: fixed an error in the modeling of float32 <-> float64 conversions when the argument is a NaN (#428).
- x86: changed the compilation of
__builtin_fminand__builtin_fmaxso that their NaN behavior is the one documented in the manual. - Improved reproducibility of register allocation. (Before, compiling CompCert with two different OCaml versions could have resulted in correct but different allocations.)
- Hardened the configure script against Cygwin installations that produce
\r\nfor end-of-lines (#434). - RISC-V: tail calls to far-away functions were causing link-time errors (#436, #437).
Coq development
- Updated the Flocq library to version 4.1.
- Support for Coq 8.14.1, 8.15.0, 8.15.1, 8.15.2.
- Minimal Coq version supported is now 8.12.0.
CompCert 3.10
Major improvement
- Bit fields in structs and unions are now handled in the formally-verified part of CompCert. (Before, they were being implemented through an unverified source-to-source translation.)
The CompCert C and Clight languages provide abstract syntax for bit-field declarations and formal semantics for bit-field accesses.
The translation of bit-field accesses to bit manipulations is performed in the Cshmgen pass and proved correct.
Usability
- The layout of bit-fields in memory now follows the ELF ABI algorithm, improving ABI compatibility for the CompCert target platforms that use ELF.
- Handle the
# 0line directive generated by some C preprocessors (#398). - Un-define the
__SIZEOF_INT128__macro that is predefined by some C preprocessors (#419). - macOS assembler: use
##instead of#to delimit comments (#399).
ISO C conformance
- Stricter checking of multi-character constants
'abc'.
Multi-wide-character constantsL'ab'are now rejected, like GCC and Clang do. - Ignore (but still warn about) unnamed plain members of structs and unions (#411).
- Ignore unnamed bit fields when initializing unions.
Bug fixing
- x86 64 bits: overflow in offset of
leaqinstructions (#407). - AArch64, ARM, PowerPC, RISC-V: wrong expansion of
__builtin_memcpy_alignedin cases involving arguments that are stack addresses (#410, #412) - PowerPC 64 bits: wrong selection of 64-bit rotate-and-mask instructions (
rldic,rldicl,rldicr), resulting in assertion failures later in the compiler. - RISC-V: update the Asm semantics to reflect the fact that register X1 is destroyed by some builtins.
Compiler internals
- The "PTree" data structure (binary tries) was reimplemented, using a canonical representation that guarantees extensionality and improves performance.
- Add the ability to give formal semantics to numerical builtins with small integer return types.
- PowerPC: share code for memory accesses between Asmgen and Asmexpand.
- Declare
__compcert_i64*helper runtime functions during the C2C pass, so that they are not visible during source elaboration.
The clightgen tool
- Add support for producing Csyntax abstract syntax instead of Clight abstract syntax (option
-csyntaxtoclightgen) (contributed by Bart Jacobs; #404, #413).
Coq development
CompCert 3.9
New features
- New port: AArch64 (ARM 64 bits, "Apple silicon") under macOS.
- Support bitfields of types other than
int, provided they are no larger than 32 bits (#387) - Support
__builtin_unreachableand__builtin_expect(#394) (but these builtins are not used for optimization yet)
Optimizations
- Improved branch tunneling: optimized conditional branches can introduce further opportunities for tunneling, which are now taken into account.
Usability
- Pragmas within functions are now ignored (with a warning) instead of being lifted just before the function like in earlier versions.
- configure script: add
-mandiroption (#382)
Compiler internals
- Finer control of variable initialization in sections. Now we can put variables initialized with symbol addresses that need relocation in specific sections (e.g.
const_dataon macOS). - Support re-normalization of function parameters at function entry, as required by the AArch64/ELF ABI.
- PowerPC 64 bits: remove
Pfcfi,Pfcfiu,Pfctiupseudo-instructions, expanding the corresponding int<->FP conversions during the selection pass instead.
Bug fixing
- PowerPC 64 bits: incorrect
ldandstdinstructions were generated and rejected by the assembler. - PowerPC: some variadic functions had the wrong position for their first variadic parameter.
- RISC-V: fix calling convention in the case of floating-point arguments that are passed in integer registers.
- AArch64: the default function alignment was incorrect, causing a warning from the LLVM assembler.
- Pick the correct archiver to build
.alibrary archives (#380). - x86 32 bits: make sure functions returning structs and unions return the correct pointer in register EAX (#377).
- PowerPC, ARM, AArch64: updated the registers destroyed by asm pseudo-instructions and built-in functions.
- Remove spurious error on initialization of a local struct containing a flexible array member.
- Fixed bug in emulation of assignment to a volatile bit-field (#395).
The clightgen tool
- Move the
$notation for Clight identifiers to scopeclight_scopeand submoduleClightNotations, to avoid clashes with Ltac2's use of$(#392).
Coq development
- Compatibility with Coq 8.12.2, 8.13.0, 8.13.1, 8.13.2.
- Compatibility with Menhir 20210419 and up.
- Oldest Coq version supported is now 8.9.0.
- Use the
liatactic instead ofomega. - Updated the Flocq library to version 3.4.0.
Licensing and distribution
- Dual-licensed source files are now distributed under the LGPL version 2.1 (plus the Inria non-commercial license) instead of the GPL version 2 (plus the Inria non-commercial license).
CompCert 3.8
New features
- Support
_Static_assertfrom ISO C11. - Support
__builtin_constant_pfrom GCC and Clang. - New port: x86 64 bits Windows with the Cygwin 64 environment. (configure with target
x86_64-cygwin). - The following built-in functions are now available for all ports:
__builtin_sqrt,__builtin_fabsf, and all variants of__builtin_clzand__builtin_ctz. - Added
__builtin_fminand__builtin_fmaxfor AArch64.
Removed features
- The x86 32 bits port is no longer supported under macOS.
Compiler internals
- Simpler translation of CompCert C casts used for their effects but not for their values.
- Known builtins whose results are unused are eliminated earlier.
- Improved error reporting for
++and--applied to pointers to incomplete types. - Improved error reporting for redefinitions and implicit definitions of built-in functions.
- Added formal semantics for some PowerPC built-ins.
The clightgen tool
- New
-canonical-identsmode, selected by default, to change the way C identifiers are encoded as CompCert idents (positive numbers). In-canonical-identsmode, a fixed one-to-one encoding is used so that the same identifier occurring in different compilation units encodes to the same number. - The
-short-identsflag restores the previous encoding where C identifiers are consecutively numbered in order of appearance, causing the same identifier to have different numbers in different compilation units. - Removed the automatic translation of annotation builtins to Coq logical assertions, which was never used and possibly confusing.
Coq and OCaml development
- Compatibility with Coq 8.12.1, 8.12.0, 8.11.2, 8.11.1.
- Can use already-installed Flocq and MenhirLib libraries instead of their local copies (options
-use-external-Flocqand-use-external-MenhirLibto theconfigurescript). - Automatically build to OCaml bytecode on platforms where OCaml native-code compilation is not available.
- Install the
compcert.configsummary of configuration choices in the same directory as the Coq development. - Updated the list of dual-licensed source files.
CompCert 3.7
ISO C conformance:
- Functions declared
externthen implementedinlineremainextern - The type of a wide char constant is
wchar_t, notint - Support vertical tabs and treat them as whitespace
- Define the semantics of
free(NULL)
Bug fixing:
- Take sign into account for conversions from 32-bit integers to 64-bit pointers
- PowerPC: more precise determination of small data accesses
- AArch64: when addressing global variables, check for correct alignment
- PowerPC, ARM: double rounding error in int64->float32 conversions
ABI conformance:
- x86, AArch64: re-normalize values of small integer types returned by function calls
- PowerPC:
floatarguments passed on stack are passed in 64-bit format - RISC-V: use the new ELF psABI instead of the old ABI from ISA 2.1
Usability and diagnostics:
- Unknown builtin functions trigger a specific error message
- Improved error messages
Coq formalization:
- Revised modeling of the PowerPC/EREF
iselinstruction - Weaker
ec_readonlycondition over external calls
(permissions can be dropped on read-only locations)
Coq and OCaml development:
- Compatibility with Coq version 8.10.1, 8.10.2, 8.11.0
- Compatibility with OCaml 4.10 and up
- Compatibility with Menhir 20200123 and up
- Coq versions prior to 8.8.0 are no longer supported
- OCaml versions prior to 4.05.0 are no longer supported