From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21269 invoked by alias); 18 Aug 2012 21:29:11 -0000 Received: (qmail 21258 invoked by uid 22791); 18 Aug 2012 21:29:10 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED,TW_CP 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, 18 Aug 2012 21:28:57 +0000 From: "lirex.software at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54180] a bug using strcat function - it depends on variable declare order, but it should not. Date: Sat, 18 Aug 2012 21:29:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: lirex.software at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Status Resolution Message-ID: In-Reply-To: References: 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-08/txt/msg01239.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54180 Denis Kolesnik changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution| |FIXED --- Comment #17 from Denis Kolesnik 2012-08-18 21:28:56 UTC --- (In reply to comment #11) > Also, you declare SQL_date_begin[10] then fill it with 11 characters > (YYYY-MM-DD plus the numm terminator) and do the same with SQL_date_end > > This is horrible, horrible code and should be deleted immediately. > > (In reply to comment #5) > > it should work without problems, because of programming language syntax which > > is a standart. > > But it works so, that SQL1 partially overwrites value of SQL_date_begin and > > values are > > not such as expected. > > Please check the standard before arguing about it. The C standard states that > for the functions in "If an array is accessed beyond the end of an > object, the behavior is undefined." > > To understand undefined behaviour see: > http://en.wikipedia.org/wiki/Undefined_behavior > > > > I never heard, that the "C" language is outdated. The "C++" is just another > > standart which includes > > the syntax of "C". > > Noone said it's outdated, what on earth are you talking about? > > > So I consider it is as an GCC error which should be fixed, also because all > > standart libraries > > come along with GCC. > > No, the strcat and strcpy functions come from the C library provided by your > OS, they do not come from GCC. If you still believe there is a bug then maybe > you should report it to Microsoft instead. thank you for understandable answer!