This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: gcc optimisation bug
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Re: gcc optimisation bug
- From: Alan Modra <alan at SPRI dot Levels dot UniSA dot Edu dot Au>
- Date: Tue, 18 Jan 2000 10:58:19 +1030 (CST)
- cc: Erik Sandberg <erik dot sandberg at euroseek dot net>
On Mon, 17 Jan 2000, Erik Sandberg wrote:
> I have found a GCC bug.
Same results under x86 gcc-20000114. Here's an addition to the testsuite
for somebody to commit. I don't have write access.
typedef struct card
{
int col;
int val;
struct card *next;
} card;
card cards[13][4];
int main(void)
{
int i, j;
card *c = (card *)0;
for (i = 0; i < 4; i++)
for (j = 0; j < 13; j++)
{
cards[j][i].val = j;
cards[j][i].col = i;
}
// link the cards together, so we get one big sorted deck of cards
for (i = 0; i < 4; i++)
for (j = 0; j < 13; j++)
{
cards[j][i].next = c;
c = &cards[j][i];
}
// c should now point to element [12][3], which should be followed by all
// other elements.
// Now cycle through them
for (i = 0; c; c = c->next)
i += c->col*13 + c->val;
if (i != 51*52/2)
abort();
exit(0);
}