Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
None
-
None
-
all
-
Runtime Error
Description
The program below is designed to detect memory corruption (such as the use of uninitialized storage) in valarray. When compiled with the latest trunk it aborts at runtime.
$ cat t.cpp && make t && ./t
#include <cassert>
#include <valarray>
struct S {
const S* const self;
S (): self (this) { }
S (const S &s): self (this)
~S ()
{ assert (this == self); }S operator+ () const
{ assert (this == self); return *this; }S operator- () const { assert (this == self); return *this; }
S operator~ () const
{ assert (this == self); return *this; }bool operator! () const
{ assert (this == self); return false; }void operator= (const S &s)
{ assert (this == self && &s == s.self); }};
int main ()
{
const std::valarray<S> a (2);
+a;
-a;
~a;
!a;
}
gcc -c -I/build/sebor/dev/stdlib/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/dev/stdlib/include -I/build/sebor/gcc-4.1.0-11s/include -I/build/sebor/dev/stdlib/examples/include -pedantic -nostdinc++ -g -W -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long t.cpp
gcc t.o -o t -L/build/sebor/gcc-4.1.0-11s/lib -lstd11s -lsupc++ -lm
Assertion failed: this == self && &s == s.self, file t.cpp, line 15
Abort (core dumped)
Attachments
Issue Links
- is related to
-
STDCXX-313 std::valarray::apply() uses uninitialized storage
- Closed
- relates to
-
STDCXX-315 std::valarray transcendentals use uninitialized storage
- Closed