You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Jeremy Dean (JIRA)" <ji...@apache.org> on 2007/06/26 01:15:25 UTC

[jira] Created: (STDCXX-461) Error in formatting of infinity

Error in formatting of infinity 
--------------------------------

                 Key: STDCXX-461
                 URL: https://issues.apache.org/jira/browse/STDCXX-461
             Project: C++ Standard Library
          Issue Type: Bug
          Components: 27. Input/Output
            Reporter: Jeremy Dean
            Priority: Minor


referrenced in e-mail thread:
http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200706.mbox/ajax/%3c46801DBC.90909@roguewave.com%3e

But the test program does demonstrate a real problem, and that is the formatting of infinity when the stream precision is greater than 7. It looks as though the num_put facet inserts the string "inf\0\0ity" into the stream rather than "inf".

$ cat u.cpp && make u && ./u | od -c
#include <cassert>
#include <iostream>
#include <sstream>

int main () {
     std::ostringstream s;
     s.precision (8);
     s << 1 / 0.0;
     std::cout << s.str () << '\n';
     assert (s.str () == "inf");
}
gcc -c -I/build/sebor/stdcxx/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx/include -I/build/sebor/stdcxx-gcc-4.1.0-11s/include
-I/build/sebor/stdcxx/examples/include  -pedantic -nostdinc++ -g  -W 
-Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   u.cpp
u.cpp: In function 'int main()':
u.cpp:8: warning: division by zero in '1 / 0.'
gcc u.o -o u  -L/build/sebor/stdcxx-gcc-4.1.0-11s/lib  -lstd11s -lsupc++ -lm Assertion failed: s.str () == "inf", file u.cpp, line 10
0000000   i   n   f  \0  \0   i   t   y  \n
0000011


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


[jira] Commented: (STDCXX-461) Error in formatting of infinity

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

Martin Sebor commented on STDCXX-461:
-------------------------------------

Here's a simplified test case:

$ cat t.cpp && gmake t && ./t
#include <cassert>
#include <sstream>

int main () {
    std::ostringstream s;
    s.precision (8);

    const std::num_put<char> &np =
        std::use_facet<std::num_put<char> >(s.getloc ());

    np.put (std::ostreambuf_iterator<char>(s), s, ' ', 1 / 0.0);

    assert (s.str () == "inf");
} 
CC -c -D_RWSTDDEBUG   -mt -I/amd/devco/sebor/stdcxx/include -I/build/sebor/stdcxx-sunpro-5.8_j8-15D/include -I/amd/devco/sebor/stdcxx/examples/include  -library=%none -g  -xarch=v9 +w   t.cpp
"/amd/devco/sebor/stdcxx/include/sstream", line 380: Warning: std::ostringstream::rdbuf hides the function std::ios::rdbuf(std::streambuf *).
"t.cpp", line 5:     Where: While specializing "std::ostringstream ".
"t.cpp", line 5:     Where: Specialized in non-template code.
1 Warning(s) detected.
CC t.o -o t -library=%none  -mt  -xarch=v9 -L/build/sebor/stdcxx-sunpro-5.8_j8-15D/lib  -R/build/sebor/stdcxx-sunpro-5.8_j8-15D/lib -lstd15D  -lm 
Assertion failed: s.str () == "inf", file t.cpp, line 13
Abort (core dumped)


> Error in formatting of infinity 
> --------------------------------
>
>                 Key: STDCXX-461
>                 URL: https://issues.apache.org/jira/browse/STDCXX-461
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>            Reporter: Jeremy Dean
>            Assignee: Martin Sebor
>            Priority: Minor
>
> referrenced in e-mail thread:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200706.mbox/ajax/%3c46801DBC.90909@roguewave.com%3e
> But the test program does demonstrate a real problem, and that is the formatting of infinity when the stream precision is greater than 7. It looks as though the num_put facet inserts the string "inf\0\0ity" into the stream rather than "inf".
> $ cat u.cpp && make u && ./u | od -c
> #include <cassert>
> #include <iostream>
> #include <sstream>
> int main () {
>      std::ostringstream s;
>      s.precision (8);
>      s << 1 / 0.0;
>      std::cout << s.str () << '\n';
>      assert (s.str () == "inf");
> }
> gcc -c -I/build/sebor/stdcxx/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx/include -I/build/sebor/stdcxx-gcc-4.1.0-11s/include
> -I/build/sebor/stdcxx/examples/include  -pedantic -nostdinc++ -g  -W 
> -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   u.cpp
> u.cpp: In function 'int main()':
> u.cpp:8: warning: division by zero in '1 / 0.'
> gcc u.o -o u  -L/build/sebor/stdcxx-gcc-4.1.0-11s/lib  -lstd11s -lsupc++ -lm Assertion failed: s.str () == "inf", file u.cpp, line 10
> 0000000   i   n   f  \0  \0   i   t   y  \n
> 0000011

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


[jira] Assigned: (STDCXX-461) Error in formatting of infinity

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

Martin Sebor reassigned STDCXX-461:
-----------------------------------

    Assignee: Martin Sebor

> Error in formatting of infinity 
> --------------------------------
>
>                 Key: STDCXX-461
>                 URL: https://issues.apache.org/jira/browse/STDCXX-461
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>            Reporter: Jeremy Dean
>            Assignee: Martin Sebor
>            Priority: Minor
>
> referrenced in e-mail thread:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200706.mbox/ajax/%3c46801DBC.90909@roguewave.com%3e
> But the test program does demonstrate a real problem, and that is the formatting of infinity when the stream precision is greater than 7. It looks as though the num_put facet inserts the string "inf\0\0ity" into the stream rather than "inf".
> $ cat u.cpp && make u && ./u | od -c
> #include <cassert>
> #include <iostream>
> #include <sstream>
> int main () {
>      std::ostringstream s;
>      s.precision (8);
>      s << 1 / 0.0;
>      std::cout << s.str () << '\n';
>      assert (s.str () == "inf");
> }
> gcc -c -I/build/sebor/stdcxx/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx/include -I/build/sebor/stdcxx-gcc-4.1.0-11s/include
> -I/build/sebor/stdcxx/examples/include  -pedantic -nostdinc++ -g  -W 
> -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   u.cpp
> u.cpp: In function 'int main()':
> u.cpp:8: warning: division by zero in '1 / 0.'
> gcc u.o -o u  -L/build/sebor/stdcxx-gcc-4.1.0-11s/lib  -lstd11s -lsupc++ -lm Assertion failed: s.str () == "inf", file u.cpp, line 10
> 0000000   i   n   f  \0  \0   i   t   y  \n
> 0000011

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


[jira] Resolved: (STDCXX-461) Error in formatting of infinity

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

Martin Sebor resolved STDCXX-461.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2

Resolved by the referenced change. Will close after test has been added to the regression suite.

> Error in formatting of infinity 
> --------------------------------
>
>                 Key: STDCXX-461
>                 URL: https://issues.apache.org/jira/browse/STDCXX-461
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 27. Input/Output
>            Reporter: Jeremy Dean
>            Assignee: Martin Sebor
>            Priority: Minor
>             Fix For: 4.2
>
>
> referrenced in e-mail thread:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200706.mbox/ajax/%3c46801DBC.90909@roguewave.com%3e
> But the test program does demonstrate a real problem, and that is the formatting of infinity when the stream precision is greater than 7. It looks as though the num_put facet inserts the string "inf\0\0ity" into the stream rather than "inf".
> $ cat u.cpp && make u && ./u | od -c
> #include <cassert>
> #include <iostream>
> #include <sstream>
> int main () {
>      std::ostringstream s;
>      s.precision (8);
>      s << 1 / 0.0;
>      std::cout << s.str () << '\n';
>      assert (s.str () == "inf");
> }
> gcc -c -I/build/sebor/stdcxx/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx/include -I/build/sebor/stdcxx-gcc-4.1.0-11s/include
> -I/build/sebor/stdcxx/examples/include  -pedantic -nostdinc++ -g  -W 
> -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   u.cpp
> u.cpp: In function 'int main()':
> u.cpp:8: warning: division by zero in '1 / 0.'
> gcc u.o -o u  -L/build/sebor/stdcxx-gcc-4.1.0-11s/lib  -lstd11s -lsupc++ -lm Assertion failed: s.str () == "inf", file u.cpp, line 10
> 0000000   i   n   f  \0  \0   i   t   y  \n
> 0000011

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


[jira] Updated: (STDCXX-461) Error in formatting of infinity

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

Martin Sebor updated STDCXX-461:
--------------------------------

          Component/s:     (was: 27. Input/Output)
                       22. Localization
    Affects Version/s: 4.1.3

> Error in formatting of infinity 
> --------------------------------
>
>                 Key: STDCXX-461
>                 URL: https://issues.apache.org/jira/browse/STDCXX-461
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 22. Localization
>    Affects Versions: 4.1.3
>            Reporter: Jeremy Dean
>            Assignee: Martin Sebor
>            Priority: Minor
>             Fix For: 4.2
>
>
> referrenced in e-mail thread:
> http://mail-archives.apache.org/mod_mbox/incubator-stdcxx-dev/200706.mbox/ajax/%3c46801DBC.90909@roguewave.com%3e
> But the test program does demonstrate a real problem, and that is the formatting of infinity when the stream precision is greater than 7. It looks as though the num_put facet inserts the string "inf\0\0ity" into the stream rather than "inf".
> $ cat u.cpp && make u && ./u | od -c
> #include <cassert>
> #include <iostream>
> #include <sstream>
> int main () {
>      std::ostringstream s;
>      s.precision (8);
>      s << 1 / 0.0;
>      std::cout << s.str () << '\n';
>      assert (s.str () == "inf");
> }
> gcc -c -I/build/sebor/stdcxx/include/ansi -D_RWSTDDEBUG -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx/include -I/build/sebor/stdcxx-gcc-4.1.0-11s/include
> -I/build/sebor/stdcxx/examples/include  -pedantic -nostdinc++ -g  -W 
> -Wall -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long   u.cpp
> u.cpp: In function 'int main()':
> u.cpp:8: warning: division by zero in '1 / 0.'
> gcc u.o -o u  -L/build/sebor/stdcxx-gcc-4.1.0-11s/lib  -lstd11s -lsupc++ -lm Assertion failed: s.str () == "inf", file u.cpp, line 10
> 0000000   i   n   f  \0  \0   i   t   y  \n
> 0000011

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