stdcxx-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-802) [HP aCC 6.16] bad codegen on ud operator new and ud ctor]
Date Fri, 28 Mar 2008 19:14:24 GMT
[HP aCC 6.16] bad codegen on ud operator new and ud ctor]
---------------------------------------------------------

                 Key: STDCXX-802
                 URL: https://issues.apache.org/jira/browse/STDCXX-802
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]
            Reporter: Martin Sebor


-------- Original Message --------
Subject: aCC 6.16 bad codegen on ud operator new and ud ctor
Date: Fri, 28 Mar 2008 13:13:03 -0600
From: Martin Sebor <sebor@roguewave.com>
Organization: Rogue Wave Software, Inc.
To: acxx@cup.hp.com

This bug has been causing a bunch of failures in our test
suite since 6.0. The user-defined dtor in class B triggers
it. Changing the number of allocated elements from 2 to 1
causes a SEGV.

Martin

{noformat}
$ cat t.cpp && aCC -AA -V t.cpp && ./a.out
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <new>

void *palloc;
void *pfree;

void* operator new (std::size_t n) throw (std::bad_alloc) {
    void* const ptr = std::malloc (n);
    std::fprintf (stderr, "operator new (%zu) ==> %p\n", n, ptr);
    return ptr;
}

void operator delete (void *ptr) throw () {
    std::fprintf (stderr, "operator delete (%p)\n", ptr);
    std::free (ptr);
}

void* operator new[] (std::size_t n) throw (std::bad_alloc) {
    void* const ptr = std::malloc (n);
    std::fprintf (stderr, "operator new[] (%zu) ==> %p\n", n, ptr);
    return palloc = ptr;
}

void operator delete[] (void *ptr) throw () {
    std::fprintf (stderr, "operator delete[] (%p)\n", ptr);
    std::free (pfree = ptr);
}

template <class T>
struct A {
    const T* x;
    A (): x (T::foo ()) { }
    ~A () { delete[] x; }
};

struct B {
    ~B () { }
    static B* foo ();
};

template <class T> T* foo (T*) { return new T [2]; }
B* B::foo () { return ::foo ((B*)0); }

int main () {
    { A<B> td; }
    assert (palloc == pfree);
}
aCC: HP C/aC++ B3910B A.06.16 [Nov 26 2007]
ld: 92453-07 linker ld HP Itanium(R) B.12.41  IPF/IPF
operator new (16) ==> 400124b0
operator new[] (6) ==> 40012510
operator delete[] (40012514)
Assertion failed: palloc == pfree, file t.cpp, line 48
ABORT instruction (core dumped)
{noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message