Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Apr 2001 22:47:06 +0400
From:      Ilya Naumov <camel@avias.com>
To:        current@freebsd.org
Subject:   problem report: optimization
Message-ID:  <1535724241.20010425224706@avias.com>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1535724241.20010425224706>