From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24871 invoked by alias); 13 Aug 2004 16:42:56 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 24737 invoked by uid 48); 13 Aug 2004 16:42:53 -0000 Date: Fri, 13 Aug 2004 16:42:00 -0000 From: "danfuzz at milk dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20040813164249.17019.danfuzz@milk.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug target/17019] New: THUMB -O1: bad code generated for simple for loop X-Bugzilla-Reason: CC X-SW-Source: 2004-08/txt/msg01290.txt.bz2 List-Id: Compiling the following with -O1 for thumb results in bogus code being generated: void badness(int a) { void zorch(int b); int b; for (b = -1; b < a + 1; b++) { zorch(b); } } In particular, it looks like the loop prologue code is screwed up and will cause the loop to always be skipped. Here's how I configured and built the compiler: $ tar -xjvf gcc-core-3.4.0.tar.bz2 $ cd gcc-3.4.0 $ ./configure --prefix=/usr/local/armdev --target=arm-elf --with-newlib --enable-languages=c The following lines were uncommented in gcc/config/arm/t-arm-elf: MULTILIB_OPTIONS += mno-thumb-interwork/mthumb-interwork MULTILIB_DIRNAMES += normal interwork MULTILIB_EXCEPTIONS += *mapcs-26/*mthumb-interwork* $ make $ sudo make install In case it matters, I'm currently using binutils-2.15. I will try this with 3.4.1 shortly. -- Summary: THUMB -O1: bad code generated for simple for loop Product: gcc Version: 3.4.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: danfuzz at milk dot com CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: arm-unknown-elf http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17019