Re: problem report: optimization

2001-04-26 Thread David Malone

On Wed, Apr 25, 2001 at 10:47:06PM +0400, Ilya Naumov wrote:

> 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:

Alfred committed a fix for this late yesterday. It should be OK now.

David.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message



problem report: optimization

2001-04-25 Thread Ilya Naumov

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:[EMAIL PROTECTED]



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message