Re: [aseek-devel] Infinite loop in searchd & compiler options

From: Kir Kolyshkin (no email)
Date: Wed Aug 27 2003 - 13:14:37 EDT


I believe the question should be addressed to GCC developers team. All I
can suggest now is
  - use gcc-2.95.3 or later gcc-2 version (such as RedHat's gcc-2.96);
  - don't use -O2 - gcc's optimizer is broken

Also, you can try it with -O1.

We were in the same situation with gcc-2.95.2 (which had a bug that
prevented ASPseek linking), and with earlier versions too. This is why
I have added Q/A number 16 to ASPseek FAQ (see
http://www.aspseek.org/faq.php#16) several years ago. The sad truth is the
statement made several years ago is still valid.

Nothing is perfect in this world, and GCC is not an exclusion.

Jens Thoms Toerring wrote:
> Hi,
>
> I have been asking about the problem with searchd getting into
> an infinite loop when searching for two words at once or for
> phrases. Since some people seem to assume that this is a gcc
> related problem I started doing a few tests to find pout what
> happens when compiling with different optimization levels.
> Here are my results:
>
>
> -ggdb3 -> works
> -g3 -> works
> -g -> works
> -g -O -> works
> -g -O2 -> doesn't work, infinite loop
> -g -O -fstrict-aliasing -> works
> -g -O -fstrict-aliasing -fstrength-reduce -> works
> -g -O -fstrict-aliasing -fstrength-reduce \
> -fregmove -> works
>
> -g -O -fstrict-aliasing -fstrength-reduce \
> -fregmove -fschedule-insns -> compiler "crashes":
>
> g++ -g -O -fstrict-aliasing -fstrength-reduce -fregmove \
> -fschedule-insns -fschedule-insns2 -DHAVE_CONFIG_H -I. \
> -I. -I../include -I../include -D_REENTRANT -c -o \
> sqldbi.o `test -f 'sqldbi.cpp' || echo './'`sqldbi.cpp
> sqldbi.cpp: In member function `void CSQLDatabaseI::LoadRanks(CUrlRanks&)':
> sqldbi.cpp:1119: unable to find a register to spill in class `AREG'
> sqldbi.cpp:1119: this is the insn:
> (insn 11387 19709 11125 (parallel [
> (set (reg:SI 1759)
> (udiv:SI (reg/v:SI 1 edx [1710])
> (reg:SI 2 ecx [1750])))
> (set (reg:SI 2 ecx [1758])
> (umod:SI (reg/v:SI 1 edx [1710])
> (reg:SI 2 ecx [1750])))
> (clobber (reg:CC 17 flags))
> ]) 277 {udivmodsi4} (insn_list 11335 (insn_list 11122 (nil)))
> (expr_list:REG_DEAD (reg:SI 2 ecx [1750])
> (expr_list:REG_UNUSED (reg:SI 1759)
> (expr_list:REG_UNUSED (reg:CC 17 flags)
> (nil)))))
> sqldbi.cpp:1119: confused by earlier errors, bailing out
> make[2]: *** [sqldbi.o] Error 1
> make[2]: Leaving directory `/home/jens/aspseek/aspseek-cvs/src'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/jens/aspseek/aspseek-cvs/src'
> make: *** [all-recursive] Error 1
>
> -g -O -fstrict-aliasing -fstrength-reduce \
> -fregmove -fcaller-saves -> works
>
> -g -O -fstrict-aliasing -fstrength-reduce \
> -fregmove -fcaller-saves \
> -fmove-all-movables -fthread-jumps -> works
>
> -g -O -fstrict-aliasing -fstrength-reduce \
> -fregmove -fcaller-saves \
> -fmove-all-movables -fthread-jumps \
> -fcse-follow-jumps -> works
>
> -g -O -fstrict-aliasing -fstrength-reduce \
> -fregmove -fcaller-saves \
> -fmove-all-movables -fthread-jumps \
> -fcse-follow-jumps -frerun-loop-opt -> works
>
> -g -O -fstrict-aliasing -fstrength-reduce \
> -fregmove -fcaller-saves \
> -fmove-all-movables -fthread-jumps \
> -fcse-follow-jumps -frerun-loop-opt \
> -fgcse -> doesn't works, infinite loop
>
> -g -O -fgcse -> works
>
>
> All this was tested with
>
> jens at ub3744:~> g++ -v
> Reading specs from /usr/lib/gcc-lib/i486-suse-linux/3.2/specs
> Configured with: ../configure --enable-threads=posix --prefix=/usr
> --with-local-prefix=/usr/local --infodir=/usr/share/info
> --mandir=/usr/share/man --libdir=/usr/lib
> --enable-languages=c,c++,f77,objc,java,ada --enable-libgcj
> --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib
> --enable-shared --enable-__cxa_atexit i486-suse-linux
> Thread model: posix
> gcc version 3.2
>
> on
>
> jens at ub3744:~> uname -a
> Linux ub3744 2.4.19-4GB #1 Fri Sep 13 13:14:56 UTC 2002 i686 unknown
>
> Does anybody has an idea what all of this could mean? I only have
> a very rudimentary understanding of what the flags may do (and for
> some of them none at all), so I don't know where exactly to look
> for or if it makes sense to try to get the GCC people to have a
> look at this (but I would fully understand them if they would
> prefer a simpler program exhibiting the problem) or has someone
> experience what kind of (perhaps a bit fishy) code constructs might
> lead to such problems...
> Regards, Jens

-- 
== kir_at_asplinux.ru = 7551596_at_ICQ = 6722750_at_sms.beemail.ru ==
I am signature virus. Copy me to your ~/.signature to help me spread.







Hosted Email Solutions

Invaluement Anti-Spam DNSBLs



Powered By FreeBSD   Powered By FreeBSD