public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18517] New: throwing not-yet-defined exceptions from templated function kills GCC
@ 2004-11-16  7:38 elegant_dice at yahoo dot com
  2004-11-16 12:58 ` [Bug c++/18517] [3.3 Regression] " pinskia at gcc dot gnu dot org
  2005-01-18 20:32 ` [Bug c++/18517] Throwing " reichelt at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: elegant_dice at yahoo dot com @ 2004-11-16  7:38 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/18517] [3.3 Regression] throwing not-yet-defined exceptions from templated function kills GCC
  2004-11-16  7:38 [Bug c++/18517] New: throwing not-yet-defined exceptions from templated function kills GCC elegant_dice at yahoo dot com
@ 2004-11-16 12:58 ` pinskia at gcc dot gnu dot org
  2005-01-18 20:32 ` [Bug c++/18517] Throwing " reichelt at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-16 12:58 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-16 12:57 -------
Broke on the mainline:
: Search converges between 2001-02-11-trunk (#6) and 2001-02-18-trunk (#7).

Fixed on the mainline : Search converges between 2003-01-15-trunk (#165) and 2003-01-17-trunk 
(#166).

So this is 3.3 regression but which has been fixed already for 3.4.0 and 4.0.0.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |ice-on-invalid-code
      Known to fail|                            |3.3.3
      Known to work|                            |2.95.3 3.4.0 4.0.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-11-16 12:58:00
               date|                            |
            Summary|throwing not-yet-defined    |[3.3 Regression] throwing
                   |exceptions from templated   |not-yet-defined exceptions
                   |function kills GCC          |from templated function
                   |                            |kills GCC
   Target Milestone|---                         |3.3.6


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/18517] Throwing not-yet-defined exceptions from templated function kills GCC
  2004-11-16  7:38 [Bug c++/18517] New: throwing not-yet-defined exceptions from templated function kills GCC elegant_dice at yahoo dot com
  2004-11-16 12:58 ` [Bug c++/18517] [3.3 Regression] " pinskia at gcc dot gnu dot org
@ 2005-01-18 20:32 ` reichelt at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-01-18 20:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-01-18 20:32 -------
Here's a reduced testcase that uses all RAM:

=============================
template<int> void foo()
{
    throw A;
}

struct A
{
    virtual ~A();
};

void bar()
{
    foo<0>();
}
=============================

Commenting out the virtual destructor gives the ICE in c_expand_expr.

I don't think we can rate this as a regression:
All released version from 2.95.3 till 3.3.5 ICE on that code.
The couple of snapshots from Phil's regression hunter that do
not ICE issue a very strange error message:

input.cc: In function `void foo() [with int  = 0]':
input.cc:12:   instantiated from here
input.cc:3: non-lvalue in unary `&'

To me that looks like garbage found in memery. A more elaborate example
can probably turn this into an ICE.

So closing as fixed in gcc 3.4.0.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
            Summary|[3.3 Regression] throwing   |Throwing not-yet-defined
                   |not-yet-defined exceptions  |exceptions from templated
                   |from templated function     |function kills GCC
                   |kills GCC                   |
   Target Milestone|3.3.6                       |3.4.0


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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-18 20:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-16  7:38 [Bug c++/18517] New: throwing not-yet-defined exceptions from templated function kills GCC elegant_dice at yahoo dot com
2004-11-16 12:58 ` [Bug c++/18517] [3.3 Regression] " pinskia at gcc dot gnu dot org
2005-01-18 20:32 ` [Bug c++/18517] Throwing " reichelt at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).