incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [STDCXX-709] ContainerData ctor and UserClass::from_char()
Date Wed, 26 Mar 2008 04:57:49 GMT
I doctored up the rwtest driver to print out progress messages
and recompiled/reran 23.list.assign. The relevant portion of
the test's output is below. It seems that operator_new() is
being called after all, and the allegedly invalid pointer is
actually one previously obtained from operator_new (400d1c7c).
So I wonder if something else is going on, like some sort of
data corruption in new.cpp. From the heap dump is seems clear
that the pointer isn't on the list. Since it's allocated just
a few calls previously, there's a very narrow window when it
could be removed from the list (and the list corrupted). We
need to find when this happens.

# INFO (S1) (3 lines):
# TEXT: std::list<UserClass>::assign(size_type, const_reference)
# CLAUSE: lib.list.assign

UserClass *UserClass::from_char(const char *, unsigned long, bool)
T *__rw_from_char(T *, const char *, unsigned long, bool) [with T = 
UserClass] (str = "ab", len = 2) ==>
     void *operator new[](unsigned long)
         operator_new (100, 1)
                     ==> 400d1c7c   <<< ALLEGEDLY INVALID POINTER
[str_ = 400d1c7c]
UserClass *UserClass::from_char(const char *, unsigned long, bool)
T *__rw_from_char(T *, const char *, unsigned long, bool) [with T = 
UserClass] (str = "", len = 0) ==>
     void *operator new[](unsigned long)
         operator_new (4, 1)
                   ==> 4004a19c
UserClass *UserClass::from_char(const char *, unsigned long, bool)
T *__rw_from_char(T *, const char *, unsigned long, bool) [with T = 
UserClass] (str = "c", len = 1) ==>
     void *operator new[](unsigned long)
         operator_new (52, 1)
                    ==> 4005fddc
void *operator new(unsigned long)
operator_new (12, 0)
void *operator new(unsigned long)
operator_new (1792, 0)
void *operator new[](unsigned long)
operator_new (2, 1)
# ERROR (S8) (4 lines):
# TEXT: /amd/devco/sebor/stdcxx/tests/src/new.cpp:211: operator delete[] 
(0x400d1c7c): invalid pointer
# CLAUSE: lib.list.assign
# LINE: 209

Martin Sebor wrote:
> Eric Lemings wrote:
>>  
> [...]
>> I also created a little test case in trunk/tests/containers that
>> links to the rwtest static library:
>>
>>     #include <rw_new.h>
>>     #include <rw_value.h>
>>
>>     int main () {
>>       UserClass* uc = UserClass::from_char("ab", 2);
> 
> Did you forget delete[] uc here?
> 
>>       return 0;
>>     }
>>
>> This test case exhibits the same problem in STDCXX-709.
> 
> For me this little test runs fine both with and without the delete
> statement. I tried 11s and 15D builds.
> 
> Martin
> 
>>
>> It has something to do with the trunk/include/rw/_new.h header
>> but I'm still not sure exactly what the problem is.
>>
>> Brad.
>>
> 
> 


Mime
View raw message