Bug 23743

Summary: 4.0.2 snapshot fails to compile valid inline asm with >= -O1
Product: gcc Reporter: Mark Loeser <mark>
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED DUPLICATE    
Severity: normal CC: gcc-bugs
Priority: P2    
Version: 4.0.2   
Target Milestone: ---   
Host: i686-pc-linux-gnu Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu Known to work:
Known to fail: Last reconfirmed:
Attachments: Preprocessed output

Description Mark Loeser 2005-09-05 22:09:51 UTC
birdbath ~ # gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with:
/var/tmp/portage/gcc-4.0.2_beta20050901/work/gcc-4.0-20050901/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.0.2-beta20050901
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.0.2-beta20050901/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.0.2-beta20050901
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.0.2-beta20050901/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.0.2-beta20050901/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.0.2-beta20050901/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --disable-libunwind-exceptions --disable-multilib
--disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.0.2-beta20050901 (Gentoo 4.0.2_beta20050901)

Failed compile:
 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.
-save-temps -O1 -pipe -Wall -DENABLE_DUMMYVIDEO -DDISKAUD_SUPPORT -DUSE_DLOPEN
-DUSE_ASMBLIT -I./hermes -I../../src/hermes -DALSA_SUPPORT
-DALSA_DYNAMIC=libasound.so.2 -DUSE_DLVSYM -DESD_SUPPORT
-DESD_DYNAMIC=libesd.so.0 -DENABLE_X11 -DXTHREADS -I./include -I./src/video
-DXFREE86_VM -DXFREE86_VMGAMMA -DXFREE86_XV -DENABLE_SVGALIB -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
i686-pc-linux-gnu-gcc: warning: -pipe ignored because -save-temps specified
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'


When -O0 is used, the compile finishes successfully.  This seems similar to bug
#22362 but the patch Jakub has on there does not resolve this issue.
Comment 1 Mark Loeser 2005-09-05 22:11:36 UTC
Created attachment 9671 [details]
Preprocessed output
Comment 2 Andrew Pinski 2005-09-05 22:13:57 UTC
Lets count the register usage:
"r"(cb),"r"(lum),
  "r"(row1),"r"(cols),"r"(row2)

there are 5, plus PIC register that make 6 and then there is the frame pointer, that makes 7 which is too 
many for x86 so this is not a GCC bug.
Comment 3 Andrew Pinski 2005-09-05 22:19:38 UTC
Reopening for a second to ...
Comment 4 Andrew Pinski 2005-09-05 22:19:58 UTC
Close as a dup of bug 11203.

*** This bug has been marked as a duplicate of 11203 ***