This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/18517] New: throwing not-yet-defined exceptions from templated function kills GCC


The following code causes GCC to suck up all RAM when 'throw error1;' is
uncommented, and to output the following error when 'throw error2;' is uncommented:

kill_gcc.cpp: In function `void test() [with T = int]':
kill_gcc.cpp:5: internal compiler error: in c_expand_expr, at c-common.c:4341
Please submit a full bug report,
etc etc etc

The code:
-------------------------------
template <typename T>
void test()
{
  // throw error1;  // to suck up all memory
  // throw error2;  // to crash gcc
}

#include <stdexcept>

struct error1 : std::runtime_error
{
  error1() : std::runtime_error("") {}
};

struct error2 {};

int main()
{
  test<int>();
}
--------------------

-- 
           Summary: throwing not-yet-defined exceptions from templated
                    function kills GCC
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: elegant_dice at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]