This looks like PR #29922, but I'm hitting it on the trunk while compiling tcp-wrappers-7.6. It didn't fail on my last system rebuild a week or two ago. Using built-in specs. Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.4.0_pre9999/work/gcc-4.4.0-9999/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.0-pre9999 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --disable-nls --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --disable-libmudflap --disable-libssp --enable-libgomp --enable-cld --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion= --enable-linux-futex --enable-checking Thread model: posix gcc version 4.4.0-pre9999 built 20081030 (Gentoo SVN ebuild) rev. 141462 () COLLECT_GCC_OPTIONS='-c' '-v' '-save-temps' '-O2' '-E' '-mtune=generic' /usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/cc1 -E -quiet -v percent_x.c -mtune=generic -O2 -fpch-preprocess ignoring nonexistent directory "/usr/local/include" ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include-fixed /usr/include End of search list. COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/:/usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/../../../../x86_64-pc-linux-gnu/bin/ LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-c' '-v' '-save-temps' '-O2' '-E' '-mtune=generic' Using built-in specs. Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.4.0_pre9999/work/gcc-4.4.0-9999/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.4.0-pre9999 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.4.0-pre9999/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --disable-nls --with-system-zlib --disable-checking --disable-werror --enable-secureplt --enable-multilib --disable-libmudflap --disable-libssp --enable-libgomp --enable-cld --disable-libgcj --enable-languages=c,c++ --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion= --enable-linux-futex --enable-checking Thread model: posix gcc version 4.4.0-pre9999 built 20081030 (Gentoo SVN ebuild) rev. 141462 () COLLECT_GCC_OPTIONS='-c' '-v' '-save-temps' '-O2' '-o' '/var/cache/ccache/tmp.hash.kali.5429.o' '-mtune=generic' /usr/libexec/gcc/x86_64-pc-linux-gnu/4.4.0-pre9999/cc1 -fpreprocessed /var/cache/ccache/percent_x.tmp.kali.5429.i -quiet -dumpbase percent_x.tmp.kali.5429.i -mtune=generic -auxbase-strip /var/cache/ccache/tmp.hash.kali.5429.o -O2 -version -o percent_x.tmp.kali.5429.s GNU C () version 4.4.0-pre9999 built 20081030 (Gentoo SVN ebuild) rev. 141462 (x86_64-pc-linux-gnu) compiled by GNU C version 4.4.0-pre9999 built 20081030 (Gentoo SVN ebuild) rev. 141462, GMP version 4.2.4, MPFR version 2.3.2. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: e9c90fc3428f6f69e680d8fe0bdc6284 percent_x.c: In function 'percent_x': percent_x.c:31: internal compiler error: in insert_into_preds_of_block, at tree-ssa-pre.c:3120 Please submit a full bug report, with preprocessed source if appropriate. (Please note that despite having "Gentoo" in the version name, this is vanilla GCC - no patches have been applied.) The ICE is not triggered with -O{0,1,s}.
Created attachment 16594 [details] percent_x.i
Reducing.
Reduced testcase: void percent_x(int ch, char *p, char* ok_chars) { char *cp = ch == 'a' ? p : ""; for (;*(cp += __builtin_strspn (cp, ok_chars));) ; } __builtin_strspn is partially redundant for cp == "" (it's zero). The zero is of wrong type becaue fold_builtin_strspn returns integer_zero_node instead of size_zero_node.
Mine. More functions need audit.
Fixed.
Subject: Bug 37976 Author: rguenth Date: Sat Nov 1 12:47:38 2008 New Revision: 141514 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141514 Log: 2008-11-01 Richard Guenther <rguenther@suse.de> PR middle-end/37976 * builtins.c (fold_builtin_strspn): Return a size_t. (fold_builtin_strcspn): Likewise. * gcc.c-torture/compile/pr37976.c: New testcase. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr37976.c Modified: trunk/gcc/ChangeLog trunk/gcc/builtins.c trunk/gcc/testsuite/ChangeLog
*** Bug 38003 has been marked as a duplicate of this bug. ***