RSSAmplifier

Blog

Krister Walfridsson’s blog

Compilers, programming languages, etc.

kristerw.github.ioRSS feed ↗10 posts

Latest posts

Part 6: Uninitialized memory

This post describes the implementation of smtgcc.

Part 5: Pointer alignment

This post describes the implementation of pysmtgcc. See “GCC Translation Validation” for background information.

Part 4: Address calculations

This post describes the implementation of pysmtgcc. See “GCC Translation Validation” for background information.

Part 3: Memory representation

This post describes the implementation of pysmtgcc. See “GCC Translation Validation” for background information.

Part 2: Verifying GCC optimizations using an SMT solver

This post describes the implementation of pysmtgcc. See “GCC Translation Validation” for background information.

Part 1: Writing a GCC plugin in Python

This post describes the implementation of pysmtgcc. See “GCC Translation Validation” for background information.

GCC Translation Validation

I am planning to do some work with SMT solvers and GCC. I usually start new projects by doing a naive implementation of the critical part to get a feel for the problems and find out what I need to learn before the real implementation. So I started this project by building a simple translation validator, similar to the LLVM Alive2 (but with many limitations).

Branch/cmove and compiler optimizations

I have recently seen several discussions on Twitter where people have been surprised/annoyed by what the compilers do to their branchless code. Here are some random comments on what the compilers do (and why).

-ffp-contract=fast

GCC per default enables one optimization for x86_64 that can change the result of floating-point operations: -ffp-contract=fast.1 This allows the compiler to do floating-point expression contraction such as combining multiplication and addition instructions with an FMA instruction.2 -ffp-contract=fast is enabled for C++ and GNU C. It is not enabled for standard C (that is, when compiling with…

Strange behavior with NaN and -ffast-math

My previous blog post said that computations producing Inf, NaN, or -0.0 in programs compiled with -ffinite-math-only and -fno-signed-zeros might cause the program to behave in strange ways, such as not evaluating either the true or false part of an if-statement.