You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2007/01/05 21:00:27 UTC

[jira] Created: (STDCXX-314) std::valarray unary operators use uninitialized storage

std::valarray unary operators use uninitialized storage
-------------------------------------------------------

                 Key: STDCXX-314
                 URL: https://issues.apache.org/jira/browse/STDCXX-314
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 26. Numerics
    Affects Versions: 4.1.2, 4.1.3
         Environment: all
            Reporter: 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 { 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)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (STDCXX-314) std::valarray unary operators use uninitialized storage

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-314:
--------------------------------

    Affects Version/s:     (was: 4.1.3)
                           (was: 4.1.2)

I cannot reproduce this with 4.1.3, or with the latest trunk for that matter.

> std::valarray unary operators use uninitialized storage
> -------------------------------------------------------
>
>                 Key: STDCXX-314
>                 URL: https://issues.apache.org/jira/browse/STDCXX-314
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 26. Numerics
>         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 { 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)

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


[jira] Commented: (STDCXX-314) std::valarray unary operators use uninitialized storage

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533985 ] 

Farid Zaripov commented on STDCXX-314:
--------------------------------------

I have tested it with MSVC8 and gcc 4.2.0.


>From command line: "-I/build/sebor/gcc-4.1.0-11s/include"
Doesn't this path means, that this issue was found with gcc 4.1.0?

> std::valarray unary operators use uninitialized storage
> -------------------------------------------------------
>
>                 Key: STDCXX-314
>                 URL: https://issues.apache.org/jira/browse/STDCXX-314
>             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 { 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)

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


[jira] Commented: (STDCXX-314) std::valarray unary operators use uninitialized storage

Posted by "Farid Zaripov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533317 ] 

Farid Zaripov commented on STDCXX-314:
--------------------------------------

Could not reproduce this issue.

> std::valarray unary operators use uninitialized storage
> -------------------------------------------------------
>
>                 Key: STDCXX-314
>                 URL: https://issues.apache.org/jira/browse/STDCXX-314
>             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 { 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)

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


[jira] Assigned: (STDCXX-314) std::valarray unary operators use uninitialized storage

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor reassigned STDCXX-314:
-----------------------------------

    Assignee: Martin Sebor

> std::valarray unary operators use uninitialized storage
> -------------------------------------------------------
>
>                 Key: STDCXX-314
>                 URL: https://issues.apache.org/jira/browse/STDCXX-314
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 26. Numerics
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: all
>            Reporter: Martin Sebor
>         Assigned To: 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 { 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)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (STDCXX-314) std::valarray unary operators use uninitialized storage

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12534079 ] 

Martin Sebor commented on STDCXX-314:
-------------------------------------

Doh! It most likely does. I missed it.

> std::valarray unary operators use uninitialized storage
> -------------------------------------------------------
>
>                 Key: STDCXX-314
>                 URL: https://issues.apache.org/jira/browse/STDCXX-314
>             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 { 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)

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


[jira] Commented: (STDCXX-314) std::valarray unary operators use uninitialized storage

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-314?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533913 ] 

Martin Sebor commented on STDCXX-314:
-------------------------------------

Which platform did you test on?

I couldn't reproduce it with gcc 3.4.6 or Intel C++ 10.0 on Linux, either. I just added a regression test for this 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 (too bad we don't have the version of gcc it failed with...)

> std::valarray unary operators use uninitialized storage
> -------------------------------------------------------
>
>                 Key: STDCXX-314
>                 URL: https://issues.apache.org/jira/browse/STDCXX-314
>             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 { 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)

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


[jira] Updated: (STDCXX-314) std::valarray unary operators use uninitialized storage

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor updated STDCXX-314:
--------------------------------

    Severity: Runtime Error

> std::valarray unary operators use uninitialized storage
> -------------------------------------------------------
>
>                 Key: STDCXX-314
>                 URL: https://issues.apache.org/jira/browse/STDCXX-314
>             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 { 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)

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


[jira] Closed: (STDCXX-314) std::valarray unary operators use uninitialized storage

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor closed STDCXX-314.
-------------------------------

    Resolution: Cannot Reproduce

Cannot reproduce. I suspect I might have made some bad local changes when I ran into it. My bad.

> std::valarray unary operators use uninitialized storage
> -------------------------------------------------------
>
>                 Key: STDCXX-314
>                 URL: https://issues.apache.org/jira/browse/STDCXX-314
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 26. Numerics
>         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 { 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)

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