Subject: warnings depend on optimization flags?
To: None <current-users@NetBSD.ORG>
From: Thorsten Frueauf <>
List: current-users
Date: 09/28/1997 11:45:07

Since the integration of the new amd (6.0a12) I noticed a strange problem
that occurs with different kinds of gcc optimization and WARNS.

For quite some time I have "COPTS?= -O4 -m486" in /etc/mk.conf and compile
successfull the whole NetBSD source tree.

Now /src/usr.sbin/amd shows some strange effects:

- with -O, -O2 and WARNS=0, WARNS=1 all compiles without an error

- with -O3, -O4 and WARNS=0 all compiles well too

- with -O3, -O4 and WARNS=1 I get:

cc -O -I/usr/src/usr.sbin/amd/amd/../include -I/usr/src/usr.sbin/amd/amd -I/usr/
src/usr.sbin/amd/libamu/obj -I. -DHAVE_CONFIG_H -O4 -m486 -Werror -Wall -Wstrict
-prototypes -Wmissing-prototypes  -c conf_parse.c
cc1: warnings being treated as errors In function `yyparse': warning: suggest parentheses around assignment used as truth value
*** Error code 1

cc -O -I/usr/src/usr.sbin/amd/fsinfo/../include -I/usr/src/usr.sbin/amd/fsinfo -I/usr/src/usr.sbin/amd/libamu/obj -I. -DHAVE_CONFIG_H -O4 -m486 -I/usr/src/usr.sbin/amd/fsinfo/../include -I/usr/src/usr.sbin/amd/fsinfo -I/usr/src/usr.sbin/amd/libamu/obj -I. -DHAVE_CONFIG_H -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes  -c fsi_lex.c
cc1: warnings being treated as errors
/usr/src/usr.sbin/amd/fsinfo/fsi_lex.l: In function `yyerror':
/usr/src/usr.sbin/amd/fsinfo/fsi_lex.l:224: warning: control reaches end of non-void function
*** Error code 1

So from looking at the above code, I think gcc got a point there:

yyerror(char *fmt, ...)
  return 0;
  /* this call will never happen */

Which means after the return comes another statement (which is not reached, so
why is it there?) which does not end with return.

Now I wonder if I see a bug of gcc or if the code should be changed.

What kind of optimization is the "best" in matter of "fastest binaries" for
a pentium machine? Or is it highly recommended to stick with the default
-O optimization?

Thanx for any help in advance!


   Name  : Thorsten Frueauf            Milano@irc cri@onaliM       //
   E-Mail: oder     \X/