The test case contains a constructor which is surrounded by a try-catch-block. Inside the constructor some memory is allocated and an exception is thrown. In the catch-block the previously allocated memory is freed which leads to an unexpected segmentation fault. Changing the constant 16 in the test case to 15 or lower lets the program run as expected. Output of gcc -v: Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.2.2/configure --prefix=/home/matuszewski/gcc-4.2.2 --program-suffix=-4.2.2 Thread model: posix gcc version 4.2.2 The bug also occurs with gcc version 3.4.6 The bug is triggerd with calling "./PlayGround".
Created attachment 14752 [details] test case to reproduce the bug
15.3/10 Referring to any non-static member or base class of an object in the handler for a function-try-block of a constructor or destructor for that object results in undefined behavior.