Compiling arch/sparc/kernel/process.c from linux-2.6.11.3 with gcc-4.1-20050709 fails with arch/sparc/kernel/process.c: In function '__show_backtrace': arch/sparc/kernel/process.c:204: internal compiler error: in compare_values, at tree-vrp.c:445 Here's the command I use to reproduce: sparc-unknown-linux-gnu-gcc \ -fno-strict-aliasing -fno-common -ffreestanding \ -O2 -fomit-frame-pointer -m32 -mno-fpu -fcall-used-g5 \ -fcall-used-g7 -c process.i I haven't reduced process.i; it's 250KB. You can download it from http://kegel.com/gcc/process.i.txt
Confirmed, reduced testcase: void __show_backtrace(void *rw) { while(rw && (((unsigned long) rw) >= 0xf0000000) ) {} } looks like a fold bug with respect of type issues. This is target independent.
And here is a testcase which fails on LP64 targets: void __show_backtrace(void *rw) { while(rw && (((unsigned long) rw) >= 0xf000000000000000) ) {} }
I have a fix.
Deity on a crutch! That was fast. Thanks; I can test if you like, or just wait for the next snapshot.
Created attachment 9244 [details] Patch which should fix this (In reply to comment #4) > Deity on a crutch! That was fast. I have been look into type mismatch lately and this just one of those cases. The problem is in build_range_check which forgets to call fold_convert in a couple cases.
Patch posted here: <http://gcc.gnu.org/ml/gcc-patches/2005-07/msg00771.html>.
A testcase which is exposed by PR 22368's second patch: int __show_backtrace(void *rw) { return (rw && (((unsigned long) rw) >= 0xf0000000) ); }
Fixed.
Subject: Bug 22398 CVSROOT: /cvs/gcc Module name: gcc Changes by: pinskia@gcc.gnu.org 2005-07-15 23:14:07 Modified files: gcc : ChangeLog fold-const.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.c-torture/compile: pr22398.c Log message: 2005-07-15 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/22398 * gcc.c-torture/compile/pr22398.c: New test. 2005-07-11 Andrew Pinski <pinskia@physics.uc.edu> PR middle-end/22398 * fold-const.c (build_range_check): Convert high/low to etype if we are only comparing against exp. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9453&r2=2.9454 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fold-const.c.diff?cvsroot=gcc&r1=1.602&r2=1.603 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5772&r2=1.5773 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/pr22398.c.diff?cvsroot=gcc&r1=NONE&r2=1.1