public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug libstdc++/57273] New: stringstream str initialization fails @ 2013-05-14 12:41 ycollette.nospam at free dot fr 2013-05-14 12:42 ` [Bug libstdc++/57273] " ycollette.nospam at free dot fr ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: ycollette.nospam at free dot fr @ 2013-05-14 12:41 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273 Bug ID: 57273 Summary: stringstream str initialization fails Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: ycollette.nospam at free dot fr It tried to initialize the content of a stringstream using the following code: std::stringstream tmpLabel; tmpLabel.str("test "); tmpLabel << 1; And the result fails. I've got on screen: '1est' instead of 'test 1'. The workaround: std::stringstream tmpLabel; tmpLabel.str(""); tmpLabel << "test " << 1; Here is a test file: #include <iostream> #include <sstream> int main() { std::stringstream tmp; tmp.str("test\0"); tmp << 1; std::cout << "result = |" << tmp.str() << "|" << std::endl; tmp.str(""); tmp << "test " << 1; std::cout << "result = |" << tmp.str() << "|" << std::endl; return 0; } ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/57273] stringstream str initialization fails 2013-05-14 12:41 [Bug libstdc++/57273] New: stringstream str initialization fails ycollette.nospam at free dot fr @ 2013-05-14 12:42 ` ycollette.nospam at free dot fr 2013-05-14 12:43 ` ycollette.nospam at free dot fr ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: ycollette.nospam at free dot fr @ 2013-05-14 12:42 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273 collette <ycollette.nospam at free dot fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unknown |4.6.3 --- Comment #1 from collette <ycollette.nospam at free dot fr> --- I use mageia2 64 bits with gcc-4.6.3. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/57273] stringstream str initialization fails 2013-05-14 12:41 [Bug libstdc++/57273] New: stringstream str initialization fails ycollette.nospam at free dot fr 2013-05-14 12:42 ` [Bug libstdc++/57273] " ycollette.nospam at free dot fr @ 2013-05-14 12:43 ` ycollette.nospam at free dot fr 2013-05-14 12:47 ` paolo.carlini at oracle dot com ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: ycollette.nospam at free dot fr @ 2013-05-14 12:43 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273 --- Comment #2 from collette <ycollette.nospam at free dot fr> --- Just tested with gcc-4.8.0 compiled from scratch and the bug is still here. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/57273] stringstream str initialization fails 2013-05-14 12:41 [Bug libstdc++/57273] New: stringstream str initialization fails ycollette.nospam at free dot fr 2013-05-14 12:42 ` [Bug libstdc++/57273] " ycollette.nospam at free dot fr 2013-05-14 12:43 ` ycollette.nospam at free dot fr @ 2013-05-14 12:47 ` paolo.carlini at oracle dot com 2013-05-14 12:55 ` ycollette.nospam at free dot fr ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: paolo.carlini at oracle dot com @ 2013-05-14 12:47 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> --- And this is not a bug, it's conforming behavior. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/57273] stringstream str initialization fails 2013-05-14 12:41 [Bug libstdc++/57273] New: stringstream str initialization fails ycollette.nospam at free dot fr ` (2 preceding siblings ...) 2013-05-14 12:47 ` paolo.carlini at oracle dot com @ 2013-05-14 12:55 ` ycollette.nospam at free dot fr 2013-05-14 12:59 ` redi at gcc dot gnu.org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: ycollette.nospam at free dot fr @ 2013-05-14 12:55 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273 --- Comment #4 from collette <ycollette.nospam at free dot fr> --- Oups. OK, I just tested with intel c++ compiler and the behavior is the same. Where is this behavior defined ? ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/57273] stringstream str initialization fails 2013-05-14 12:41 [Bug libstdc++/57273] New: stringstream str initialization fails ycollette.nospam at free dot fr ` (3 preceding siblings ...) 2013-05-14 12:55 ` ycollette.nospam at free dot fr @ 2013-05-14 12:59 ` redi at gcc dot gnu.org 2013-05-14 13:01 ` redi at gcc dot gnu.org 2013-05-14 13:05 ` ycollette.nospam at free dot fr 6 siblings, 0 replies; 8+ messages in thread From: redi at gcc dot gnu.org @ 2013-05-14 12:59 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273 --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- [stringbuf.members]/3 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/57273] stringstream str initialization fails 2013-05-14 12:41 [Bug libstdc++/57273] New: stringstream str initialization fails ycollette.nospam at free dot fr ` (4 preceding siblings ...) 2013-05-14 12:59 ` redi at gcc dot gnu.org @ 2013-05-14 13:01 ` redi at gcc dot gnu.org 2013-05-14 13:05 ` ycollette.nospam at free dot fr 6 siblings, 0 replies; 8+ messages in thread From: redi at gcc dot gnu.org @ 2013-05-14 13:01 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273 --- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Which also explains that you can make the inserted characters append to the buffer using std::ios::ate e.g. std::stringstream tmpLabel(std::ios::ate|std::ios::out); or using an ostringstream std::ostringstream tmpLabel(std::ios::out); ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/57273] stringstream str initialization fails 2013-05-14 12:41 [Bug libstdc++/57273] New: stringstream str initialization fails ycollette.nospam at free dot fr ` (5 preceding siblings ...) 2013-05-14 13:01 ` redi at gcc dot gnu.org @ 2013-05-14 13:05 ` ycollette.nospam at free dot fr 6 siblings, 0 replies; 8+ messages in thread From: ycollette.nospam at free dot fr @ 2013-05-14 13:05 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57273 --- Comment #7 from collette <ycollette.nospam at free dot fr> --- Thanks for these informations. Sorry for the noise. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-05-14 13:05 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-05-14 12:41 [Bug libstdc++/57273] New: stringstream str initialization fails ycollette.nospam at free dot fr 2013-05-14 12:42 ` [Bug libstdc++/57273] " ycollette.nospam at free dot fr 2013-05-14 12:43 ` ycollette.nospam at free dot fr 2013-05-14 12:47 ` paolo.carlini at oracle dot com 2013-05-14 12:55 ` ycollette.nospam at free dot fr 2013-05-14 12:59 ` redi at gcc dot gnu.org 2013-05-14 13:01 ` redi at gcc dot gnu.org 2013-05-14 13:05 ` ycollette.nospam at free dot fr
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).