I have some code (will be attached) that fails to compile with GCC 4.5.0 if you use the exact right (wrong) flags: $ g++-4.5.0 -fPIC -m32 -O2 -c cpuid.cpp -o cpuid.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h: In function 'unsigned int get_x86_cache_line_size()': /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h:179:52: error: can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h:179:52: error: 'asm' operand has impossible constraints /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h:179:52: error: 'asm' operand has impossible constraints /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h:179:52: error: 'asm' operand has impossible constraints If not using -fPIC, or if using -O instead of -O2, it compiles. This code compiles with the same flags (and any other permutation I've thought to try) with GCC 4.3.1 and 4.4.3. As far as I know the code is valid. I've pruned it down as much as I could. $ g++-4.5.0 -v Using built-in specs. COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.0/g++ COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /tmp/portage/sys-devel/gcc-4.5.0/work/gcc-4.5.0/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-ppl --with-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --enable-cld --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.5.0/python --disable-libgcj --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.0 p1.0' Thread model: posix gcc version 4.5.0 (Gentoo 4.5.0 p1.0) This is the Gentoo build of GCC 4.5.0, but I've checked the packaging; there are no noticeable patches being applied to the 4.5.0 sources, so I think this is a problem in vanilla 4.5.0.
Created attachment 20591 [details] Testcase
It is triggered by revision 147395: http://gcc.gnu.org/ml/gcc-cvs/2009-05/msg00369.html
Well, it probably failed before with -funroll-loops. Why's the cpuid functions not marked with noinline?
(In reply to comment #3) > Well, it probably failed before with -funroll-loops. Why's the cpuid functions > not marked with noinline? Because it is only one instruction?
For some reason, when I change it to C, it compiles.
Perhaps related to PR44174.
(In reply to comment #6) > Perhaps related to PR44174. Not just perhaps but exactly the same both have the same constraints. Note this testcase here works now on the trunk but that could have been because of other changes. *** This bug has been marked as a duplicate of 44174 ***