Bug 37665 - invalid loop generation
Summary: invalid loop generation
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-27 20:59 UTC by Joel Sherrill
Modified: 2011-01-27 17:28 UTC (History)
4 users (show)

See Also:
Host:
Target: m32c-elf
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
small test program (79 bytes, text/x-csrc)
2008-09-27 21:00 UTC, Joel Sherrill
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joel Sherrill 2008-09-27 20:59:41 UTC
At optimization levels -Os, -O1, and -O2, the attached program generates incorrect loop code.  It appears that when optimizing, the loop termination is checking array end address versus current pointer.  The array end address contains all address bits while the current pointer is just the lower (16?) bits.

m32c-elf-gcc -O1 -mcpu=m32cm -msim m1.c && m32c-elf-run a.out 
NULL pointer dereference

Attaching test program.
Comment 1 Joel Sherrill 2008-09-27 21:00:50 UTC
Created attachment 16417 [details]
small test program

test program demonstrating problem
Comment 2 Ralf Corsepius 2011-01-27 14:02:45 UTC
Joel, could you check if this bug still is present and if it affects RTEMS?

From what I can gather from looking at the asm gcc generates, this bug might be fixed in gcc-4.5.x (rtems-4.11)
Comment 3 Joel Sherrill 2011-01-27 17:28:03 UTC
(In reply to comment #2)
> Joel, could you check if this bug still is present and if it affects RTEMS?
> 
> From what I can gather from looking at the asm gcc generates, this bug might be
> fixed in gcc-4.5.x (rtems-4.11)

The program does run to completion now.  This was hanging m32c during RTEMS initialization of the priority chains.  So now I should test that side of the world.