I've compiled alpha 0.3.1 on my Linux server. I've updated my CVS working copy as of a few moments ago. Looks like there haven't been any recent changes.
I have revision 1.74 of dfa.cpp and the reason for the SIGSEGV is an attempt to dereference a null pointer in the case when the op is opGlobal:
prog->getGlobalType(name) returns a null pointer for the given input and, of course, the SIGSEGV is thrown on line 1265 when it is dereferenced.
I'd <em>love</em> to code the fix but since I am totally unfamiliar with Unary::decendType I thought it would be wise to ask first if anyone has a good suggestion.
I could try executing lines 1265 and 1266 only if ty is not null but I would not know if the output is valid.
Thanks for any assistance you can render.
Jeff
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmm, there this:
Type *ty = prog->getGlobalType((char*)gloName);
if (s->isAssign() && ((Assign*)s)->getType()) {
int bits = ((Assign*)s)->getType()->getSize();
if (ty == NULL || ty->getSize() == 0)
prog->setGlobalType((char*)gloName, new IntegerType(bits));
}
around line 200 in dfa. I tried:
case opGlobal: {
Prog* prog = s->getProc()->getProg();
char* name = ((Const*)subExp1)->getStr();
Type* ty = prog->getGlobalType(name);
if (ty == NULL || ty->getSize() == 0) {
prog->setGlobalType(name, new IntegerType(1));
// prog->setGlobalType((char*)gloName, new IntegerType(bits));
} else {
ty = ty->meetWith(parentType, ch);
prog->setGlobalType(name, ty);
}
break;
but w/ the same result.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've compiled alpha 0.3.1 on my Linux server. I've updated my CVS working copy as of a few moments ago. Looks like there haven't been any recent changes.
I have revision 1.74 of dfa.cpp and the reason for the SIGSEGV is an attempt to dereference a null pointer in the case when the op is opGlobal:
1200: void Unary::descendType(Type* parentType, bool& ch, Statement* s){
1201: switch (op) {
...
1261: case opGlobal: {
1262: Prog* prog = s->getProc()->getProg();
1263: char* name = ((Const*)subExp1)->getStr();
1264: Type* ty = prog->getGlobalType(name);
1265: ty = ty->meetWith(parentType, ch);
1266: prog->setGlobalType(name, ty);
1267: break;
1268: }
...
prog->getGlobalType(name) returns a null pointer for the given input and, of course, the SIGSEGV is thrown on line 1265 when it is dereferenced.
I'd <em>love</em> to code the fix but since I am totally unfamiliar with Unary::decendType I thought it would be wise to ask first if anyone has a good suggestion.
I could try executing lines 1265 and 1266 only if ty is not null but I would not know if the output is valid.
Thanks for any assistance you can render.
Jeff
Hmm, there this:
Type *ty = prog->getGlobalType((char*)gloName);
if (s->isAssign() && ((Assign*)s)->getType()) {
int bits = ((Assign*)s)->getType()->getSize();
if (ty == NULL || ty->getSize() == 0)
prog->setGlobalType((char*)gloName, new IntegerType(bits));
}
around line 200 in dfa. I tried:
case opGlobal: {
Prog* prog = s->getProc()->getProg();
char* name = ((Const*)subExp1)->getStr();
Type* ty = prog->getGlobalType(name);
if (ty == NULL || ty->getSize() == 0) {
prog->setGlobalType(name, new IntegerType(1));
// prog->setGlobalType((char*)gloName, new IntegerType(bits));
} else {
ty = ty->meetWith(parentType, ch);
prog->setGlobalType(name, ty);
}
break;
but w/ the same result.