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]

Re: c++/10300: [3.2/3.3/3.4 regression] use of array-new (nothrow) in segfaults on NULL return


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


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