[Commit] nickle compile.c,1.158,1.159
Bart Massey
commit at keithp.com
Fri Oct 1 12:58:56 PDT 2004
- Next message: [Commit]
twin ChangeLog, 1.13, 1.14 twin.h, 1.10, 1.11 twin_fixed.c,
1.2, 1.3 twin_font.c, 1.9, 1.10 twin_path.c, 1.7,
1.8 twin_poly.c, 1.6, 1.7 twin_screen.c, 1.3, 1.4 twin_x11.c,
1.2, 1.3 twin_x11.h, 1.1, 1.2 twinint.h, 1.8, 1.9 xtwin.c,
1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: bart
Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv23538
Modified Files:
compile.c
Log Message:
Compiler dumped core when trying to create a variable of
incomplete structure type.
Index: compile.c
===================================================================
RCS file: /local/src/CVS/nickle/compile.c,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- compile.c 7 Jul 2004 07:32:47 -0000 1.158
+++ compile.c 1 Oct 2004 19:58:54 -0000 1.159
@@ -419,9 +419,13 @@
}
static TypePtr
-CompileRefType (TypePtr t)
+CompileRefType (ObjPtr obj, ExprPtr expr, TypePtr t)
{
t = TypeCanon (t);
+ if (!t) {
+ CompileError(obj, expr, "reference to incomplete type");
+ return 0;
+ }
if (t->base.tag == type_ref && !t->ref.pointer)
return t->ref.ref;
@@ -622,7 +626,7 @@
}
if (flipTypes)
{
- t = CompileRefType (expr->base.type);
+ t = CompileRefType (obj, expr, expr->base.type);
if (amper)
{
if (t)
@@ -2237,7 +2241,7 @@
if (!inst)
break;
expr->base.type = s->symbol.type;
- t = CompileRefType (expr->base.type);
+ t = CompileRefType (obj, expr, expr->base.type);
if (t)
{
BuildInst (obj, OpUnFunc, inst, stat);
@@ -2412,7 +2416,7 @@
}
BuildInst (obj, OpDot, inst, stat);
inst->atom.atom = expr->tree.right->atom.atom;
- t = CompileRefType (expr->base.type);
+ t = CompileRefType (obj, expr, expr->base.type);
if (t)
{
BuildInst (obj, OpUnFunc, inst, stat);
@@ -2435,7 +2439,7 @@
}
BuildInst (obj, OpArrow, inst, stat);
inst->atom.atom = expr->tree.right->atom.atom;
- t = CompileRefType (expr->base.type);
+ t = CompileRefType (obj, expr, expr->base.type);
if (t)
{
BuildInst (obj, OpUnFunc, inst, stat);
@@ -2452,7 +2456,7 @@
case AMPER:
obj = CompileLvalue (obj, expr->tree.left, stat, code, False, False, False,
False, True);
- t = CompileRefType (expr->tree.left->base.type);
+ t = CompileRefType (obj, expr->tree.left, expr->tree.left->base.type);
if (!t)
t = expr->tree.left->base.type;
expr->base.type = NewTypeRef (t, True);
@@ -4064,7 +4068,7 @@
lvalue = NewExprAtom (decl->name, decl->symbol, False);
*initObj = CompileLvalue (*initObj, lvalue,
decls, code, False, True, True,
- CompileRefType (s->symbol.type) != 0,
+ CompileRefType (obj, lvalue, s->symbol.type) != 0,
False);
SetPush (*initObj);
*initObj = CompileInit (*initObj, init, s->symbol.type, stat, code);
- Next message: [Commit]
twin ChangeLog, 1.13, 1.14 twin.h, 1.10, 1.11 twin_fixed.c,
1.2, 1.3 twin_font.c, 1.9, 1.10 twin_path.c, 1.7,
1.8 twin_poly.c, 1.6, 1.7 twin_screen.c, 1.3, 1.4 twin_x11.c,
1.2, 1.3 twin_x11.h, 1.1, 1.2 twinint.h, 1.8, 1.9 xtwin.c,
1.12, 1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Commit
mailing list