Libsdl-1.2.9 fails to compile with gcc4

With gcc4, we are unable to compile libsdl with any optimization greater
than -O0. The failure that we have been receiving with the new version
of libsdl is as follows:

i686-pc-linux-gnu-gcc -DPACKAGE_NAME="" -DPACKAGE_TARNAME=""
-DPACKAGE_VERSION="" -DPACKAGE_STRING="" -DPACKAGE_BUGREPORT=""
-DPACKAGE=“SDL” -DVERSION=“1.2.9” -DSTDC_HEADERS=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1
-DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_LIBASOUND=1 -I. -I. -O2
-march=athlon-xp -mtune=athlon-xp -pipe -Wall -DENABLE_DUMMYVIDEO
-DDISKAUD_SUPPORT -DUSE_DLOPEN -DUSE_ASMBLIT -I./hermes
-I…/…/src/hermes -DALSA_SUPPORT -DALSA_DYNAMIC=libasound.so.2
-DUSE_DLVSYM -DENABLE_X11 -DXTHREADS -I./include -I./src/video
-DXFREE86_VM -DXFREE86_VMGAMMA -DXFREE86_XV -DHAVE_XINERAMA
-DENABLE_SVGALIB -DENABLE_AALIB -DHAVE_OPENGL -DUSE_INPUT_EVENTS
-D_REENTRANT -DSDL_USE_PTHREADS -DHAVE_SIGACTION -DHAVE_LINUX_VERSION_H
-I…/…/include -I…/…/include/SDL -I…/…/src -I…/…/src/main/linux
-I…/…/src/audio -I…/…/src/video -I…/…/src/video/XFree86/extensions
-I…/…/src/events -I…/…/src/joystick -I…/…/src/cdrom
-I…/…/src/thread -I…/…/src/timer -I…/…/src/endian -I…/…/src/file
-I…/…/src/thread -c SDL_yuv_mmx.c -fPIC -DPIC -o .libs/SDL_yuv_mmx.o
SDL_yuv_mmx.c: In function ‘ColorRGBDitherYV12MMX1X’:
SDL_yuv_mmx.c:113: error: can’t find a register in class 'GENERAL_REGS’
while reloading 'asm’
make[3]: *** [SDL_yuv_mmx.lo] Error 1

This seems to be due to the gcc2 compatiblity patch that was added to
this file for 1.2.9. By removing the volatiles that were added, we can
compile it again, but I doubt this is a good fix. The asm should
probably be changed to not depend on 5 registers, but this is beyond my
abilities. If someone could help out, or suggest a fix, I would
appreciate it.

Thanks,

Mark Loeser
-------------- next part --------------
A non-text attachment was scrubbed…
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20050923/cae80dba/attachment.pgp

This seems to be due to the gcc2 compatiblity patch that was added to
this file for 1.2.9. By removing the volatiles that were added, we can
compile it again, but I doubt this is a good fix. The asm should
probably be changed to not depend on 5 registers, but this is beyond my
abilities. If someone could help out, or suggest a fix, I would
appreciate it.

Can you try the latest in CVS and see if it fixes things?

–ryan.