Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 21360 invoked from network); 7 May 2007 17:30:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 May 2007 17:30:36 -0000 Received: (qmail 84406 invoked by uid 500); 7 May 2007 17:30:43 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 84391 invoked by uid 500); 7 May 2007 17:30:43 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 84379 invoked by uid 99); 7 May 2007 17:30:43 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 May 2007 10:30:43 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 May 2007 10:30:35 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 4751A71403B for ; Mon, 7 May 2007 10:30:15 -0700 (PDT) Message-ID: <18443058.1178559015289.JavaMail.jira@brutus> Date: Mon, 7 May 2007 10:30:15 -0700 (PDT) From: "Martin Sebor (JIRA)" To: stdcxx-dev@incubator.apache.org Subject: [jira] Commented: (STDCXX-402) long long stream extraction fails for strings longer than 9 decimal characters In-Reply-To: <1350792.1178554695548.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/STDCXX-402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494089 ] Martin Sebor commented on STDCXX-402: ------------------------------------- Something very bizarre is going on here. I was able to reliably reproduce slightly different but equally incorrect behavior on trunk (you didn't say which version you used) in an 11s build with gcc 4.1.0 on Solaris 9 with the simplified test case below. What's bizarre about it is that when I step through (but not run) the same program in gdb 6.5 I get the expected output. Replacing the string temporary with just the string literal lets the program behave correctly suggesting some kind of weird memory corruption. Current directory is /build/sebor/stdcxx-gcc-4.1.0-11s/examples/ GNU gdb 6.5 Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.9"... (gdb) l 1 #include 2 #include 3 4 int main () { 5 std::stringstream s (std::string ("2147483640")); 6 long long n = 0; 7 s >> n; 8 std::printf ("%llu\n", n); 9 } (gdb) r Starting program: /build/sebor/stdcxx-gcc-4.1.0-11s/examples/u 9223372036854775807 Program exited normally. (gdb) b main Breakpoint 1 at 0x11c20: file u.cpp, line 5. (gdb) r Starting program: /build/sebor/stdcxx-gcc-4.1.0-11s/examples/u Breakpoint 1, main () at u.cpp:5 (gdb) n (gdb) n (gdb) n (gdb) n 2147483640 (gdb) c Continuing. Program exited normally. (gdb) > long long stream extraction fails for strings longer than 9 decimal characters > ------------------------------------------------------------------------------ > > Key: STDCXX-402 > URL: https://issues.apache.org/jira/browse/STDCXX-402 > Project: C++ Standard Library > Issue Type: Bug > Components: 27. Input/Output > Environment: $ uname -a > Linux cyberdyne 2.6.17.8 #9 SMP PREEMPT Wed Nov 22 09:34:35 EST 2006 i686 unknown unknown GNU/Linux > $ gcc -v > Using built-in specs. > Target: i486-slackware-linux > Configured with: ../gcc-src/configure --prefix=/opt/compilers/gcc-4.1.2 --enable-shared --enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld --verbose --target=i486-slackware-linux --host=i486-slackware-linux --enable-languages=c,c++ > Thread model: posix > gcc version 4.1.2 > Built a 15s version of the library. > Reporter: Liviu Nicoara > > The following test case: > $ cat t.cpp > #include > #include > #include > int > main () > { > long long n = 0; > { > std::stringstream s (std::string ("214748364")); > s >> n; > std::cout << n << "\n"; > } > { > std::stringstream s (std::string ("2147483640")); > s >> n; > std::cout << n << "\n"; > } > return 0; > } > Produces inconsistent (but consistently wrong) results in different runs: > $ ./t > 214748364 > 9223372036854775807 > $ ./t > 214748364 > 214748365089 > $ ./t > 214748364 > 9223372036854775807 > Liviu -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.