public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36804] New: For-loop never exits in gcc for ARM.
@ 2008-07-11 8:47 dan dot aberg at keystream dot se
2008-12-16 16:48 ` [Bug target/36804] " rearnsha at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: dan dot aberg at keystream dot se @ 2008-07-11 8:47 UTC (permalink / raw)
To: gcc-bugs
I've made a small example where a for-loop never exits when it should. I have
tried gcc 4.2.1, 4.2.4 and 4.3.1 with the same result. Gcc 4.1.1 works.
GCC is configured with:
../configure --prefix=/opt/arm-linux/arm --host=i686-linux-gnu
--target=arm-linux-gnu --build=i686-linux-gnu
--includedir=/opt/arm-linux/arm/arm-linux-gnu/usr/include --enable-multilib
--enable-threads --disable-nls --enable-shared --enable-languages=c,c++
--enable-__cxa_atexit --enable-c99 --enable-long-long
The example is compiled with:
arm-linux-gnu-gcc -O1 -Wall -march=armv5 -o bug main.c
main.c:
---
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
struct dummy {
unsigned short count;
unsigned short options;
};
unsigned foo (unsigned x)
{
return x << 1;
}
int main (int argc, char* argv[])
{
struct dummy *d;
unsigned count;
unsigned i;
unsigned short* w;
unsigned phase;
unsigned long long val;
d = malloc (sizeof(struct dummy));
d->count = 1;
d->options = 0;
count = d->count;
w = malloc (sizeof(unsigned short));
for (i=0; i<count; i++) {
phase = (unsigned)((long long)(0xFFFFFFFF) * i / count);
val = foo (phase);
w[i] = (unsigned short)val;
fprintf (stderr, "i: %u, count: %u\n", i, count);
}
return 0;
}
---
--
Summary: For-loop never exits in gcc for ARM.
Product: gcc
Version: 4.2.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dan dot aberg at keystream dot se
GCC build triplet: i686-linux-gnu
GCC host triplet: i686-linux-gnu
GCC target triplet: arm-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36804
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/36804] For-loop never exits in gcc for ARM.
2008-07-11 8:47 [Bug c/36804] New: For-loop never exits in gcc for ARM dan dot aberg at keystream dot se
@ 2008-12-16 16:48 ` rearnsha at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: rearnsha at gcc dot gnu dot org @ 2008-12-16 16:48 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from rearnsha at gcc dot gnu dot org 2008-12-16 16:45 -------
I'm unable to reproduce this with any of svn-trunk, gcc-4.1.3 (debian),
gcc-4.3.3 (SVN) or gcc-4.3.2 (debian). The loop essentially reads as
mov r7, #1
mov r6, #0
L5:
...
add r6, r6, #1
cmp r7, r6
bhi L5
This will iterate only while r7 is larger than r6 -- that is, exactly once,
when r6 is 0.
--
rearnsha at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |WORKSFORME
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36804
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-16 16:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-11 8:47 [Bug c/36804] New: For-loop never exits in gcc for ARM dan dot aberg at keystream dot se
2008-12-16 16:48 ` [Bug target/36804] " rearnsha at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).