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] Reopened: (STDCXX-315) std::valarray transcendentals use uninitialized storage
Date Mon, 30 Apr 2007 23:55:15 GMT

     [ https://issues.apache.org/jira/browse/STDCXX-315?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Martin Sebor reopened STDCXX-315:
---------------------------------


Reopening -- the modified test case below still shows 2 failures:

std::atan2 uses uninitialized storage
std::atan2 uses uninitialized storage


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <new>
#include <valarray>

void* operator new (std::size_t s) throw (std::bad_alloc)
{
    return std::memset (std::malloc (s), 0x55, s);
}

bool pass = true;

struct S {
    const S* const self;
    S (): self (this) { }
    S (const S &s): self (this) { pass = pass && &s == s.self; }
    S (double): self (this) { }
    ~S () { pass = pass && this == self; }
    operator double () const { pass = pass && this == self; return 1.0; }

    void operator=(const S &s) const {
        pass = pass && &s == s.self && this == self;
    }
    S operator- () const { pass = pass && this == self; return *this; }
    bool operator< (const S &s) const {
        pass = pass && &s == s.self && this == self;
        return false;
    }
};

int main ()
{
    const S s;
    const std::valarray<S> a (2);

#define TEST(fun, args) \
    pass = true; \
    fun args; \
    if (!pass) \
        std::fprintf (stderr, "std::%s uses uninitialized storage\n", #fun)

    TEST (abs, (a));
    TEST (acos, (a));
    TEST (asin, (a));
    TEST (atan, (a));
    TEST (atan2, (a, a));
    TEST (atan2, (a, s));
    TEST (atan2, (s, a));
    TEST (cos, (a));
    TEST (cosh, (a));
    TEST (exp, (a));
    TEST (log, (a));
    TEST (log10, (a));
    TEST (pow, (a, a));
    TEST (pow, (a, s));
    TEST (pow, (s, a));
    TEST (sin, (a));
    TEST (sinh, (a));
    TEST (sqrt, (a));
    TEST (tan, (a));
    TEST (tanh, (a));
} 


> std::valarray transcendentals use uninitialized storage
> -------------------------------------------------------
>
>                 Key: STDCXX-315
>                 URL: https://issues.apache.org/jira/browse/STDCXX-315
>             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 expected to produce no output. When compiled with the latest trunk
it produces output indicating that the valarray transcendental functions use uninitialized
storage.
> $ cat t.cpp && make t && ./t
> #include <cstdio>
> #include <valarray>
> bool pass = true;
> struct S {
>     const S* const self;
>     S (): self (this) { }
>     S (const S &s): self (this) { pass = pass && &s == s.self; }
>     S (double): self (this) { }
>     ~S () { pass = pass && this == self; }
>     operator double () const { pass = pass && this == self; return 1.0; }
>     void operator=(const S &s) const {
>         pass = pass && &s == s.self && this == self;
>     }
>     S operator- () const { pass = pass && this == self; return *this; }
>     bool operator< (const S &s) const {
>         pass = pass && &s == s.self && this == self;
>         return false;
>     }
> };
> int main ()
> {
>     const S s;
>     const std::valarray<S> a (2);
> #define TEST(fun, args) \
>     pass = true; \
>     fun args; \
>     if (!pass) \
>         std::fprintf (stderr, "std::%s uses uninitialized storage\n", #fun)
>     TEST (abs, (a));
>     TEST (acos, (a));
>     TEST (asin, (a));
>     TEST (atan, (a));
>     TEST (atan2, (a, a));
>     TEST (atan2, (a, s));
>     TEST (atan2, (s, a));
>     TEST (cos, (a));
>     TEST (cosh, (a));
>     TEST (exp, (a));
>     TEST (log, (a));
>     TEST (log10, (a));
>     TEST (pow, (a, a));
>     TEST (pow, (a, s));
>     TEST (pow, (s, a));
>     TEST (sin, (a));
>     TEST (sinh, (a));
>     TEST (sqrt, (a));
>     TEST (tan, (a));
>     TEST (tanh, (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 
> std::abs uses uninitialized storage
> std::acos uses uninitialized storage
> std::asin uses uninitialized storage
> std::atan uses uninitialized storage
> std::atan2 uses uninitialized storage
> std::atan2 uses uninitialized storage
> std::atan2 uses uninitialized storage
> std::cos uses uninitialized storage
> std::cosh uses uninitialized storage
> std::exp uses uninitialized storage
> std::log uses uninitialized storage
> std::log10 uses uninitialized storage
> std::pow uses uninitialized storage
> std::pow uses uninitialized storage
> std::pow uses uninitialized storage
> std::sin uses uninitialized storage
> std::sinh uses uninitialized storage
> std::sqrt uses uninitialized storage
> std::tan uses uninitialized storage
> std::tanh uses uninitialized storage

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