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".


-- 
           Summary: program crashes when using a try-catch-block around a
                    constructor
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: c dot matuszewski at gmx dot de
  GCC host triplet: i386-redhat-linux
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34461

Reply via email to