From owner-freebsd-current Wed Apr 25 11:46:53 2001 Delivered-To: freebsd-current@freebsd.org Received: from camel.avias.com (camel.avias.com [195.14.38.87]) by hub.freebsd.org (Postfix) with ESMTP id 377C837B43C for ; Wed, 25 Apr 2001 11:46:44 -0700 (PDT) (envelope-from camel@avias.com) Received: from gr.avias.local (gr.avias.local [192.168.2.2]) by camel.avias.com (8.11.3/8.11.3) with ESMTP id f3PIkAO38088 for ; Wed, 25 Apr 2001 22:46:10 +0400 (MSD) (envelope-from camel@avias.com) Date: Wed, 25 Apr 2001 22:47:06 +0400 From: Ilya Naumov X-Mailer: The Bat! (v1.51) Educational Reply-To: Ilya Naumov X-Priority: 3 (Normal) Message-ID: <1535724241.20010425224706@avias.com> To: current@freebsd.org Subject: problem report: optimization MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello, i've discovered that now the world cannot be built without any optimization options (-Oxx) due to a 'dirty' code in some places. one of good examples is usr.sbin/rpc.lockd. without -Oxx options kern.c fails compilation: cc -pipe -march=k6 -I. -I/usr/include/rpcsvc -g -o rpc.lockd kern.o nlm_prot_svc.o lockd.o lock_proc.o lockd_lock.o -lrpcsvc -lutil kern.o: In function `test_request': /garbage/src/usr.sbin/rpc.lockd/kern.c(.text+0x504): undefined reference to `from_addr' kern.o: In function `lock_request': /garbage/src/usr.sbin/rpc.lockd/kern.c(.text+0x743): undefined reference to `from_addr' kern.o: In function `unlock_request': /garbage/src/usr.sbin/rpc.lockd/kern.c:387: undefined reference to `from_addr' kern.o: In function `lock_answer': /garbage/src/usr.sbin/rpc.lockd/kern.c:454: undefined reference to `show_4state' /garbage/src/usr.sbin/rpc.lockd/kern.c:454: undefined reference to `show_state' *** Error code 1 Stop in /garbage/src/usr.sbin/rpc.lockd. but with optimizations turned on it compiles well. the problem is in the pieces of code like below: #define d_calls 0 . . if (d_calls) . . from_addr((struct sockaddr_in *)&msg->lm_addr)); obvious, that the code inside 'if' statement can't be ever executed, and 'cc' with optimizations enabled doesn't even process it. but without optimizations, all the code is being included into the object file, which, of course, can't be linked because 'from_addr' is really undefined. i understand that -O option is used by default, but i think that unnecesary code should be commented out or deleted from sources because such tricks decrease readability and create problems described above. -- Best regards, Ilya mailto:camel@avias.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message