Top "Undefined-behavior" questions

The unpredictable outcome of compiling or executing a program which breaks rules of the language neither compiler, interpreter nor runtime-system have to enforce.

What is the strict aliasing rule?

When asking about common undefined behavior in C, people sometimes refer to the strict aliasing rule. What are they talking …

c undefined-behavior strict-aliasing type-punning
Undefined behavior and sequence points

What are "sequence points"? What is the relation between undefined behaviour and sequence points? I often use funny and convoluted …

c++ undefined-behavior c++-faq sequence-points
Counter exit code 139 when running, but gdb make it through

My question sounds specific, but I doubt it still can be of a C++ debug issue. I am using omnet++ …

c++ gdb segmentation-fault undefined-behavior
Why are these constructs using pre and post-increment undefined behavior?

#include <stdio.h> int main(void) { int i = 0; i = i++ + ++i; printf("%d\n", i); // 3 i = 1; i = (i++); …

c increment undefined-behavior operator-precedence sequence-points
What are all the common undefined behaviours that a C++ programmer should know about?

What are all the common undefined behaviours that a C++ programmer should know about? Say, like: a[i] = i++;

c++ undefined undefined-behavior c++-faq
Why does this loop produce "warning: iteration 3u invokes undefined behavior" and output more than 4 lines?

Compiling this: #include <iostream> int main() { for (int i = 0; i < 4; ++i) std::cout << i*1000000000 <&…

c++ gcc undefined-behavior
Undefined, unspecified and implementation-defined behavior

What is undefined behavior in C and C++? What about unspecified behavior and implementation-defined behavior? What is the difference between …

c++ c undefined-behavior unspecified-behavior implementation-defined-behavior
Why is unsigned integer overflow defined behavior but signed integer overflow isn't?

Unsigned integer overflow is well defined by both the C and C++ standards. For example, the C99 standard (§6.2.5/9) states A …

c++ c undefined-behavior integer-overflow
Does the C++ standard allow for an uninitialized bool to crash a program?

I know that an "undefined behaviour" in C++ can pretty much allow the compiler to do anything it wants. However, …

c++ llvm undefined-behavior abi llvm-codegen
Operation on ... may be undefined?

I have the following code FRAME frameArray[5][10]; // Create the array of frames int trackBufferFull[5] = {0, 0, 0, 0, 0};// Keeps track of how full the …

c undefined-behavior