From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15510 invoked by alias); 6 Nov 2007 21:01:59 -0000 Received: (qmail 15098 invoked by uid 48); 6 Nov 2007 21:01:48 -0000 Date: Tue, 06 Nov 2007 21:01:00 -0000 Message-ID: <20071106210148.15097.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug middle-end/33970] Missed optimization using unsigned char loop variable In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "wvangulik at xs4all dot nl" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-11/txt/msg00537.txt.bz2 ------- Comment #11 from wvangulik at xs4all dot nl 2007-11-06 21:01 ------- I just realised I did not tried hard enough to find the smallest case: =========================================== volatile unsigned char bar; void foo(void) { unsigned char x; for(x=0;x<128; x++) { //bar = x+1; bar = x; } } Looks like using the loop counter inside the loop causes the problem. Because when not using x, but just e.g. calling a function is also gives the smallest loop. Looking at the RTL output of test.c.00.expand. it allready is a QI vs HI there... so it's going wrong some where inside gcc I really have no knowledge off... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33970