This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/10300: [3.2/3.3/3.4 regression] use of array-new (nothrow) in segfaults on NULL return
- From: bangerth at dealii dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, jaf at lcsaudio dot com, nobody at gcc dot gnu dot org
- Date: 3 Apr 2003 14:45:13 -0000
- Subject: Re: c++/10300: [3.2/3.3/3.4 regression] use of array-new (nothrow) in segfaults on NULL return
- Reply-to: bangerth at dealii dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, jaf at lcsaudio dot com, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Old Synopsis: array-new (nothrow) in templated inner class crashes on NULL return
New Synopsis: [3.2/3.3/3.4 regression] use of array-new (nothrow) in segfaults on NULL return
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Thu Apr 3 14:45:13 2003
State-Changed-Why:
Behavior confirmed. Here's a slightly trimmed example:
-----------------------------
#include <new>
void * operator new[](size_t, std::nothrow_t const &) throw()
{ return NULL; }
struct X {
struct Inner { ~Inner() {} };
X() {
Inner * ic = new (std::nothrow) Inner[1]; // SegFault here
}
};
int main() {
X table;
}
-----------------------------------
It segfaults at the indicated line when compiled with
3.2, 3.3 and mainline, but not with 2.95, so assuming
the code is doing something legal, this is a regression.
To be honest, I don't know what the standard assumes what
happens for this program, so this needs someone more
familiar with these things.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10300