summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-09-10 22:04:12 +0200
committerAraq <rumpf_a@web.de>2013-09-10 22:04:12 +0200
commit275c7ccf82e03622258c135890c0419e70ee0884 (patch)
tree986a3e9a990c26dc9b0ad6fedbbdfd1ac49f3d9d /compiler
parent138db5a85d1cb613d126241139471e849150ca05 (diff)
downloadNim-275c7ccf82e03622258c135890c0419e70ee0884.tar.gz
fixes #575
Diffstat (limited to 'compiler')
-rw-r--r--compiler/ccgexprs.nim3
-rw-r--r--compiler/cgen.nim8
2 files changed, 2 insertions, 9 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim
index 6b3906226..c50fd4536 100644
--- a/compiler/ccgexprs.nim
+++ b/compiler/ccgexprs.nim
@@ -304,7 +304,7 @@ proc genAssignment(p: BProc, dest, src: TLoc, flags: TAssignmentFlags) =
   of tyObject:
     # XXX: check for subtyping?
     if needsComplexAssignment(ty):
-      if asgnComplexity(ty.n) <= 4:
+      if ty.sons[0].isNil and asgnComplexity(ty.n) <= 4:
         discard getTypeDesc(p.module, ty)
         internalAssert ty.n != nil
         genOptAsgnObject(p, dest, src, flags, ty.n)
@@ -1017,7 +1017,6 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) =
     rawGenNew(p, tmp, nil)
     t = t.sons[0].skipTypes(abstractInst)
     r = ropef("(*$1)", r)
-  # XXX object initialization? but not necessary for temps, is it?
   discard getTypeDesc(p.module, t)
   for i in 1 .. <e.len:
     let it = e.sons[i]
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 0c3f2da84..f33de9df0 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -384,12 +384,6 @@ proc initLocalVar(p: BProc, v: PSym, immediateAsgn: bool) =
     if not immediateAsgn:
       constructLoc(p, v.loc)
 
-proc initTemp(p: BProc, tmp: var TLoc) =
-  # XXX: This is still suspicious.
-  # Objects should always be constructed?
-  if containsGarbageCollectedRef(tmp.t) or isInvalidReturnType(tmp.t):
-    constructLoc(p, tmp)
-
 proc getTemp(p: BProc, t: PType, result: var TLoc) = 
   inc(p.labels)
   if gCmd == cmdCompileToLLVM: 
@@ -402,7 +396,7 @@ proc getTemp(p: BProc, t: PType, result: var TLoc) =
   result.t = getUniqueType(t)
   result.s = OnStack
   result.flags = {}
-  initTemp(p, result)
+  constructLoc(p, result)
 
 proc keepAlive(p: BProc, toKeepAlive: TLoc) =
   when false: