http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56580
Bug #: 56580 Summary: Internal compiler error when trying to compile a sequence of NOPs inside a loop Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: trivial Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: ahyan...@gmail.com Created attachment 29629 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29629 The code that triggers the bug. I am trying to do a silly thing: to produce a program that's bigger than my L1 Instruction cache but smaller than my L2 cache, so the speed of the L2 cache can be measured. My implementation is simple: I put a sequence of NOPs as inline assembly, inside a for-loop. When I compile the code (see attachment) with -O2 or -O3 option, gcc 4.7.2 throws out internal error. Not that the bug is anywhere harmful. I can happily do without any optimization flags in this case. But I still think it's worth reporting, as fixing it may be helpful to prevent other potential bugs. By the way, my other versions of gcc (4.2.4, 4.4.7, 4.5.4) all work without any problems. The code in the attachment uses 12288 NOPS inside the for-loop, which loops 1000 times. Lowering the former to 10240 or lowering the latter to 500 both seem to eliminate the problem. I am using Gentoo Linux. When I compile my gcc-4.7.2 using Portage, I didn't set any optimization flags other than -O2 and -march=native. My machine is an i7 box. Finally, the following is the output of `gcc -v -save-temps -O2 GCC4.7-bug.c`: Using built-in specs. COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.2/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.2/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.7.2-r1/work/gcc-4.7.2/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.2 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.2 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.2/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.2/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.2/python --enable-checking=release --enable-libstdcxx-time --enable-languages=c,c++,java,go,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.2-r1 p1.4, pie-0.5.5' --enable-plugin Thread model: posix gcc version 4.7.2 (Gentoo 4.7.2-r1 p1.4, pie-0.5.5) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-mtune=generic' '-march=x86-64' /usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.2/cc1 -E -quiet -v GCC4.7-bug.c -mtune=generic -march=x86-64 -O2 -fpch-preprocess -o GCC4.7-bug.i ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include /usr/lib/gcc/x86_64-pc-linux-gnu/4.7.2/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-O2' '-mtune=generic' '-march=x86-64' /usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.2/cc1 -fpreprocessed GCC4.7-bug.i -quiet -dumpbase GCC4.7-bug.c -mtune=generic -march=x86-64 -auxbase GCC4.7-bug -O2 -version -o GCC4.7-bug.s GNU C (Gentoo 4.7.2-r1 p1.4, pie-0.5.5) version 4.7.2 (x86_64-pc-linux-gnu) compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.1, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 GNU C (Gentoo 4.7.2-r1 p1.4, pie-0.5.5) version 4.7.2 (x86_64-pc-linux-gnu) compiled by GNU C version 4.7.2, GMP version 5.0.2, MPFR version 3.1.1, MPC version 1.0.1 GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: b73b2677ca23c504b32a2ee915f40344 GCC4.7-bug.c: In function ‘main’: GCC4.7-bug.c:12303:1: internal compiler error: in account_size_time, at ipa-inline-analysis.c:601 Please submit a full bug report, with preprocessed source if appropriate. See <http://bugs.gentoo.org/> for instructions.