tests/reject/temptycaseobj.nim

This commit is contained in:
Araq
2011-06-19 16:01:54 +02:00
parent 18bec94e22
commit 898e5c3d2c
2 changed files with 5 additions and 45 deletions

View File

@@ -7,43 +7,6 @@
# distribution, for details about the copyright.
#
proc checkTypeInfo*(dest: Pointer, src: int, mt: pointer)
proc checkTypeInfo(dest: Pointer, src: int, n: ptr TNimNode) =
var
d = cast[TAddress](dest)
s = cast[TAddress](src)
case n.kind
of nkSlot: checkTypeInfo(cast[pointer](d +% n.offset), src, n.typ)
of nkList:
for i in 0..n.len-1: checkTypeInfo(dest, src, n.sons[i])
of nkCase:
var m = selectBranch(dest, n)
if m != nil: checkTypeInfo(dest, src, m)
else:
c_fprintf(cstdout, "ugh memory corruption! in check type info %ld\n", src)
quit 1
#of nkNone: assert(false)
proc checkTypeInfo(dest: Pointer, src: int, mt: pointer) =
var mt = cast[PNimType](mt)
var
d = cast[TAddress](dest)
s = cast[TAddress](src)
assert(mt != nil)
case mt.Kind
of tyString: nil
of tySequence: nil
of tyObject, tyTuple, tyPureObject:
checkTypeInfo(dest, src, mt.node)
of tyArray, tyArrayConstr:
for i in 0..(mt.size div mt.base.size)-1:
checkTypeInfo(cast[pointer](d +% i*% mt.base.size),
src, mt.base)
of tyRef: nil
else:
nil # copy raw bits
proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool)
proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode, shallow: bool) =
var
@@ -61,10 +24,10 @@ proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode, shallow: bool) =
n.typ.size)
var m = selectBranch(src, n)
if m != nil: genericAssignAux(dest, src, m, shallow)
else:
echo "ugh memory corruption! ", n.kind
quit 1
#of nkNone: assert(false)
of nkNone: assert(false)
#else:
# echo "ugh memory corruption! ", n.kind
# quit 1
proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) =
var

View File

@@ -1,9 +1,5 @@
High priority (version 0.8.12)
==============================
- sorting with leads to a strange memory corruption: tsimplesort
--> system.swap or genericAssign is broken! And indeed, if reference counts
are not modified and the GC is triggered in between a swap, bad things
may happen!
- bug: invoking a generic iterator twice triggers a code gen bug (titer2)
* implement message passing built-ins
* add --deadlock_prevention:on|off switch? timeout for locks?
@@ -14,6 +10,7 @@ High priority (version 0.8.12)
version 0.9.0
=============
- bug: tfFinal not passed to generic
- bug: forward proc for generic seems broken
- test the sort implementation again
- warning for implicit openArray -> varargs convention