[Bug tree-optimization/53265] Warn when undefined behavior implies smaller iteration count
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 29 17:23:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53265
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-29 17:22:34 UTC ---
Other examples from
https://lists.fedoraproject.org/pipermail/devel/2013-January/175876.html
to test the potential warning (requires 32-bit integer and 64-bit long long):
void bar (void *);
void
fn1 (void)
{
unsigned int a[128];
int i;
for (i = 0; i < 128; ++i)
a[i] = i * 0x02000001;
bar (a);
}
void
fn2 (void)
{
unsigned long long a[128];
int i;
for (i = 0; i < 128; i++)
a[i] = (i + 1LL) * 0x0123456789ABCDEFLL;
bar (a);
}
void
fn3 (void)
{
unsigned char a[16], b[16], c[16];
int i;
bar (b);
for (i = 0; i < (int) (sizeof (a) / sizeof (a[0])); i++)
{
c[i + 8] = b[i];
a[i + 8] = b[i + 8];
}
bar (a);
bar (c);
}
void
fn4 (void)
{
unsigned int *a[32], *o, i;
bar (a);
for (i = 0; i <= sizeof (a) / sizeof (a[0]); i++)
{
o = a[i];
bar (o);
}
}
void
fn5 (void)
{
unsigned short a[23940];
unsigned int b[1140];
int j;
bar (b);
for (j = 0; j < 1140; j++)
a[23940 + j - 950] = b[j];
bar (a);
}
More information about the Gcc-bugs
mailing list