This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
neat bug in alias analysis
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: neat bug in alias analysis
- From: Mike Stump <mrs at wrs dot com>
- Date: Wed, 18 Aug 1999 08:34:10 -0700 (PDT)
This code:
typedef struct node {
struct node * left;
struct node * right;
} NODE;
void testRebalance (NODE ***ancestors,
int count) {
NODE ** nodepp;
NODE * nodep;
NODE * leftp;
nodepp = ancestors[--count];
nodep = *nodepp;
leftp = nodep->left;
nodep->left = leftp->right;
leftp->right = nodep;
*nodepp = (void*)42;
}
fails, the store or 42 into memory is moved before the two proceeding
lines, whereas this code:
typedef struct node {
struct node * left;
struct node * right;
} NODE;
void testRebalance (struct node ***ancestors,
int count) {
struct node ** nodepp;
struct node * nodep;
struct node * leftp;
nodepp = ancestors[--count];
nodep = *nodepp;
leftp = nodep->left;
nodep->left = leftp->right;
leftp->right = nodep;
*nodepp = (void*)42;
}
works. The only difference is NODE v struct node, but they _are_ the
same type. I did this is the top of the gcc tree just now. If you
find a fix, let me know.