Opened 16 years ago
Closed 16 years ago
#222 closed defect (fixed)
Infinite loop with pointer usage in .mmp file
| Reported by: | dfix | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | Release 1.0 |
| Component: | examples | Version: | 1.0 |
| Keywords: | .mmp, Node, pointer | Cc: |
Description
The line Node *p0 = &a0; causes an infinite loop.
typedef struct Node{
struct Node* next;
int value;
} Node;
void main () {
//infinite loop
Node a0;
Node *p0 = &a0;
a0.value = 4;
assert a0.value == 4;
assert p0->value == 4;
}
java.lang.StackOverflowError
at edu.udel.cis.vsl.tass.front.minimp.ast.type.StructType.equals(StructType.java:84)
at edu.udel.cis.vsl.tass.front.minimp.ast.type.PointerType.equals(PointerType.java:26)
at edu.udel.cis.vsl.tass.front.minimp.ast.type.StructType.equals(StructType.java:87)
at edu.udel.cis.vsl.tass.front.minimp.ast.type.PointerType.equals(PointerType.java:26)
at edu.udel.cis.vsl.tass.front.minimp.ast.type.StructType.equals(StructType.java:87)
at edu.udel.cis.vsl.tass.front.minimp.ast.type.PointerType.equals(PointerType.java:26)
at edu.udel.cis.vsl.tass.front.minimp.ast.type.StructType.equals(StructType.java:87)
at edu.udel.cis.vsl.tass.front.minimp.ast.type.PointerType.equals(PointerType.java:26)
at edu.udel.cis.vsl.tass.front.minimp.ast.type.StructType.equals(StructType.java:87)
at...

Fixed defect in AST's Type mechanism. Equals method was not prepared to deal with cycles in type relation, yielding infinite recursion. I broke the recursion at a StructType. Decided two struct types were equal iff their names are equal.