From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Using stpcpy Date: Sat, 27 Dec 2014 22:17:45 +0200 Message-ID: <83a928ludy.fsf@gnu.org> References: <549849A7.3070208@yandex.ru> <54991006.8030208@cs.ucla.edu> <54994677.9080608@yandex.ru> <549C0242.3010402@cs.ucla.edu> <549C4C7C.2070001@yandex.ru> <549CA168.8050002@cs.ucla.edu> <83zjaaksua.fsf@gnu.org> <83tx0hlen1.fsf@gnu.org> <83bnmolvkb.fsf@gnu.org> <878uhsvp1d.fsf@engster.org> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1419711498 30163 80.91.229.3 (27 Dec 2014 20:18:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Dec 2014 20:18:18 +0000 (UTC) Cc: chengang31@gmail.com, emacs-devel@gnu.org To: David Engster Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 27 21:18:10 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Y4xoN-0004Oc-H9 for ged-emacs-devel@m.gmane.org; Sat, 27 Dec 2014 21:18:07 +0100 Original-Received: from localhost ([::1]:56819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4xoM-00086j-R4 for ged-emacs-devel@m.gmane.org; Sat, 27 Dec 2014 15:18:06 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4xoI-00086S-Le for emacs-devel@gnu.org; Sat, 27 Dec 2014 15:18:03 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y4xoF-0005Gb-Fu for emacs-devel@gnu.org; Sat, 27 Dec 2014 15:18:02 -0500 Original-Received: from mtaout25.012.net.il ([80.179.55.181]:50170) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4xoF-0005GO-7t for emacs-devel@gnu.org; Sat, 27 Dec 2014 15:17:59 -0500 Original-Received: from conversion-daemon.mtaout25.012.net.il by mtaout25.012.net.il (HyperSendmail v2007.08) id <0NH900900BH1YJ00@mtaout25.012.net.il> for emacs-devel@gnu.org; Sat, 27 Dec 2014 22:13:49 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout25.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NH900AYRC715R10@mtaout25.012.net.il>; Sat, 27 Dec 2014 22:13:49 +0200 (IST) In-reply-to: <878uhsvp1d.fsf@engster.org> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:180721 Archived-At: > From: David Engster > Cc: chengang31@gmail.com, emacs-devel@gnu.org > Date: Sat, 27 Dec 2014 21:03:10 +0100 > > > Incredible as it sounds, in an optimized build, GCC (sometimes?) calls > > stpcpy even though the source calls strcpy, provided that the > > prototype of stpcpy is in scope. In this case, ntlib.c includes > > windows.h, which includes string.h, which comes from lib/string.h, > > which declares the prototype of stpcpy, and that is enough to trigger > > this misfeature. > > > > I fixed this by switching the order of the libraries, as suggested, > > but only because doing so is TRT in general. > > Yes, it seems gcc optimizes this because of the following strlen > call. You can disable this optimization with -fno-optimize-strlen. GCC shouldn't have done that by default. It's nasty.