incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Commented: (STDCXX-313) std::valarray::apply() uses uninitialized storage
Date Thu, 11 Oct 2007 00:45:57 GMT

    [ https://issues.apache.org/jira/browse/STDCXX-313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533916
] 

Martin Sebor commented on STDCXX-313:
-------------------------------------

As in the case of STDCXX-314, I couldn't reproduce this problem with gcc 3.4.6 or Intel C++
10.0 on Linux, either. But I added a regression test for this issue as well so let's keep
an eye on it and if it passes on other platforms we can go ahead and assume it either got
fixed by some other change or it was a compiler bug.

> std::valarray::apply() uses uninitialized storage
> -------------------------------------------------
>
>                 Key: STDCXX-313
>                 URL: https://issues.apache.org/jira/browse/STDCXX-313
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 26. Numerics
>    Affects Versions: 4.1.2, 4.1.3
>         Environment: all
>            Reporter: Martin Sebor
>            Assignee: Martin Sebor
>             Fix For: 4.2
>
>
> 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) { assert (&s == s.self); }
>     ~S () { assert (this == self); }
>     S& operator= (const S &s) {
>         assert (this == self && &s == s.self);
>         return *this;
>     }
> };
> S foo (S s) { return s; }
> S bar (const S &s) { return s; }
> int main ()
> {
>     const std::valarray<S> a (1);
>     a.apply (foo);
>     a.apply (bar);
> }
> 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 10
> Abort (core dumped)

-- 
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