Tag Archives: undefined-behavior

SuperTest and Frama-C: a Clash of Titans
A. Maroneze (Frama-C), V. Yaglamunov & M. Beemster (Solid Sands) on 16 November 2022

This post has been co-written with Solid Sands; it is also available at the Solid Sands blog. Some time ago, the Frama-C team entered into a partner agreement with Solid Sands to make use of SuperTest, a very thorough test suite for C compilers and libraries. From basic syntactic tests...

Read More

The overflow when converting from float to integer is undefined behavior
Pascal Cuoq on 9 October 2013

Integer overflows in C A previous post on this blog was a reminder that in C signed integer arithmetic overflow is undefined behavior. In contrast the behavior of overflows in conversions from integer type to signed integer type is implementation-defined. The C99 standard allows for an implementation-defined signal to be...

Read More

From Pascal strings to Python tuples
Pascal Cuoq on 31 July 2013

Quiz time What does the program below do? #include <stdio.h> int main(){ struct { int t[4]; int u; } v; v.u = 3; v.t[4] = 4; printf(\v.u=%d" v.u); return 0; } Two answers are “it prints v.u=4” and “it prints v.u=3”: $ gcc t.c && ./a.out v.u=4 $ gcc -O2...

Read More

Attack by Compiler
Pascal Cuoq on 20 May 2013

The title of this post, “Attack by Compiler”, has been at the back of my mind for several weeks. It started with a comment by jduck on a post earlier this year. The post's topic, the practical undefinedness of reading from uninitialized memory, and jduck's comment, awakened memories from a...

Read More

Making oughts from ises
Pascal Cuoq on 13 April 2013

A previous post discussed the nature of uninitialized and indeterminate memory throughout the C standards. The argument was “avoid using uninitialized data even if you think you know what you are doing; you may be right but regardless your compiler might think it knows what you are doing and be...

Read More