From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David Engster Newsgroups: gmane.emacs.devel Subject: Re: Using stpcpy Date: Sat, 27 Dec 2014 21:49:50 +0100 Message-ID: <874msgvmvl.fsf@engster.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> <83a928ludy.fsf@gnu.org> <838uhslu0q.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1419713408 26088 80.91.229.3 (27 Dec 2014 20:50:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Dec 2014 20:50:08 +0000 (UTC) Cc: chengang31@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 27 21:50:03 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 1Y4yJG-0003EW-T4 for ged-emacs-devel@m.gmane.org; Sat, 27 Dec 2014 21:50:03 +0100 Original-Received: from localhost ([::1]:56858 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4yJG-0006cz-3G for ged-emacs-devel@m.gmane.org; Sat, 27 Dec 2014 15:50:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49539) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4yJC-0006cs-82 for emacs-devel@gnu.org; Sat, 27 Dec 2014 15:49:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y4yJ9-00086b-2d for emacs-devel@gnu.org; Sat, 27 Dec 2014 15:49:58 -0500 Original-Received: from randomsample.de ([5.45.97.173]:56948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4yJ8-00086O-Pu; Sat, 27 Dec 2014 15:49:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=randomsample.de; s=a; h=Content-Type:MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From; bh=nwPZimFuZrm1I407xN2d+uLbcn3CS9MRWM1ef7TokmU=; b=LsJDSJ0neRURRN7YiT1Fv0CVR7ff+55XzCK57n3euAOjerVNQ7mbVV3Ny7ADdTId8IZq5MLhKRuvbQkhNiup/LMD2/0cYx/9f04/ziKAhIQATRcgSHRqsfb41WJ7ILIh; Original-Received: from ip4d154cb9.dynamic.kabel-deutschland.de ([77.21.76.185] helo=spaten) by randomsample.de with esmtpsa (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Y4yJ7-0005s9-3P; Sat, 27 Dec 2014 21:49:53 +0100 In-Reply-To: <838uhslu0q.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 27 Dec 2014 22:25:41 +0200") User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/24.3.91 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 5.45.97.173 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:180723 Archived-At: Eli Zaretskii writes: >> Date: Sat, 27 Dec 2014 22:17:45 +0200 >> From: Eli Zaretskii >> Cc: chengang31@gmail.com, emacs-devel@gnu.org >> >> > 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. > > To say nothing of the fact that this switch is not documented in the > GCC manual, not even in the manual that comes with GCC 4.8. It was documented in the GCC 4.7 release notes https://gcc.gnu.org/gcc-4.7/changes.html but was apparently forgotten for the regular docs. It's not even in 4.9.2, but it seems they just fixed it, since at least -foptimize-strlen is now documented: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#Optimize-Options However, the above release notes also say that it will only switch functions "for hosted compilations where stpcpy is available in the runtime and headers provide its prototype", so the prototype alone should not be enough. Why does GCC think that your runtime provides stpcpy when it does not? -David