This section of code is used in a bootloader to test DRAM.
It loops over the DRAM performing various operations of reads and writes.
When optimization (O2 or Os) is switched on the second loop in this example no
longer terminates, but continues indefinitely because the loop condition has
been removed from the optimized code
--
Summary: Optimizer removes condition check to terminate loop
Product: gcc
Version: 4.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nick dot spence at freescale dot com
GCC build triplet: gcc version 4.1.2 20070626 (Red Hat 4.1.2-13)
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36232