Subject: Re: egcs optimization strangeness
To: Thorsten Frueauf <>
From: Jeff Thieleke <>
List: current-users
Date: 04/24/1998 18:20:50
> I tried to compile pkgsrc/games/xjig with NetBSD/i386 current (23.4.98)
> using egcs. I got the following error while linking:
> gcc -O5 -I/usr/X11R6/include -o xjig xjig.o objects.o stack.o imgbuff.o
> puzzle.o                       real.o vec2.o vec2list.o mat2.o
>            color_mapper.o gif_image.o gifx_image.o -O2
> -fno-strength-reduce      -L/usr/X11R6/lib -lXext -lX11 -lm
> -lgnumalloc 
> objects.o: Definition of symbol `___CTOR_LIST__' (multiply defined)
> vec2.o: Definition of symbol `___CTOR_LIST__' (multiply defined)
> The problem is the -O5 optimation (this were .C files btw). If I compile
> everything with -O2, all compiles/links well. So I can just patch
> the -O5 default to -O2 - but this seems to be a problem with egcs, which
> should get ironed out...

This is very strange, since as far as I can tell, egcs ignores any optimization
settings over -O3:

  if (optimize >= 3)
      flag_inline_functions = 1;

It is also strange since normally, the last argument on the command line is
used (-O2 instead of -O5 in this case).

BTW, I believe -fno-strength-reduce isn't necessary with gcc >2.7.

Jeff Thieleke