From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18504 invoked by alias); 15 Sep 2012 14:12:55 -0000 Received: (qmail 18489 invoked by uid 22791); 15 Sep 2012 14:12:53 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_BJ,TW_CX,TW_DC,TW_GX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 15 Sep 2012 14:12:41 +0000 From: "temp78593 at mutluit dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54591] New: sscanf format no more working Date: Sat, 15 Sep 2012 14:12:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: temp78593 at mutluit dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-09/txt/msg01171.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54591 Bug #: 54591 Summary: sscanf format no more working Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: critical Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: temp78593@mutluit.com sscanf no more working, it was ok in prev. versions: #include #include int main() { const char* psz = " PROTO=TCP SPT=6004 DPT=26532 "; char szProto[256] = ""; unsigned short usSrcPort = 0, usDstPort = 0; const int c = sscanf(psz, " PROTO=%255[^ \t\n]s SPT=%hu DPT=%hu", szProto, &usSrcPort, &usDstPort); printf("%s\n", c == 3 ? "OK" : "ERROR"); //... return 0; } It fills only the first field --> c=1 --> ERROR This code was working fine in prev. compiler versions. # g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.1-2' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.1 (Debian 4.7.1-2)