summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xcompiler/ccgstmts.nim2
-rwxr-xr-xcompiler/ccgutils.nim10
-rwxr-xr-xcompiler/transf.nim3
-rwxr-xr-xconfig/nimrod.cfg2
-rw-r--r--lib/pure/collections/tables.nim2
-rwxr-xr-xlib/system/assign.nim9
-rwxr-xr-xtodo.txt3
7 files changed, 15 insertions, 16 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim
index c9b5832fb..d45035989 100755
--- a/compiler/ccgstmts.nim
+++ b/compiler/ccgstmts.nim
@@ -17,7 +17,7 @@ proc genLineDir(p: BProc, t: PNode) =
   var line = toLinenumber(t.info) # BUGFIX
   if line < 0: 
     line = 0                  # negative numbers are not allowed in #line
-  if optLineDir in p.Options: 
+  if optLineDir in p.Options and line > 0: 
     appff(p.s[cpsStmts], "#line $2 \"$1\"$n", "; line $2 \"$1\"$n", 
           [toRope(toFilename(t.info)), toRope(line)])
   if ({optStackTrace, optEndb} * p.Options == {optStackTrace, optEndb}) and
diff --git a/compiler/ccgutils.nim b/compiler/ccgutils.nim
index f1d66ca94..e0f714594 100755
--- a/compiler/ccgutils.nim
+++ b/compiler/ccgutils.nim
@@ -62,13 +62,10 @@ proc initTypeTables() =
   for i in countup(low(TTypeKind), high(TTypeKind)): InitIdTable(gTypeTable[i])
   
 proc GetUniqueType*(key: PType): PType = 
-  var 
-    t: PType
-    k: TTypeKind
   # this is a hotspot in the compiler!
   result = key
   if key == nil: return 
-  k = key.kind
+  var k = key.kind
   case k 
   of tyObject, tyEnum: 
     result = PType(IdTableGet(gTypeTable[k], key))
@@ -84,20 +81,19 @@ proc GetUniqueType*(key: PType): PType =
     # to be compared by their structure:
     if IdTableHasObjectAsKey(gTypeTable[k], key): return 
     for h in countup(0, high(gTypeTable[k].data)): 
-      t = PType(gTypeTable[k].data[h].key)
+      var t = PType(gTypeTable[k].data[h].key)
       if (t != nil) and sameType(t, key): 
         return t
     IdTablePut(gTypeTable[k], key, key)
 
 proc TableGetType*(tab: TIdTable, key: PType): PObject = 
-  var t: PType
   # returns nil if we need to declare this type
   result = IdTableGet(tab, key)
   if (result == nil) and (tab.counter > 0): 
     # we have to do a slow linear search because types may need
     # to be compared by their structure:
     for h in countup(0, high(tab.data)): 
-      t = PType(tab.data[h].key)
+      var t = PType(tab.data[h].key)
       if t != nil: 
         if sameType(t, key): 
           return tab.data[h].val
diff --git a/compiler/transf.nim b/compiler/transf.nim
index f0a8caadb..6c3aea0b3 100755
--- a/compiler/transf.nim
+++ b/compiler/transf.nim
@@ -195,8 +195,7 @@ proc transformVarSection(c: PTransf, v: PNode): PTransNode =
     if it.kind == nkCommentStmt: 
       result[i] = PTransNode(it)
     elif it.kind == nkIdentDefs: 
-      if (it.sons[0].kind != nkSym):
-        InternalError(it.info, "transformVarSection")
+      if it.sons[0].kind != nkSym: InternalError(it.info, "transformVarSection")
       var newVar = copySym(it.sons[0].sym)
       incl(newVar.flags, sfFromGeneric) 
       # fixes a strange bug for rodgen:
diff --git a/config/nimrod.cfg b/config/nimrod.cfg
index 32849a68a..fd1142c3a 100755
--- a/config/nimrod.cfg
+++ b/config/nimrod.cfg
@@ -7,7 +7,7 @@
 # @putenv "key" "val"
 # Environment variables cannot be used in the options, however!
 
-cc = gcc
+cc = clang
 
 @if nim: 
   # use the old fixed library for bootstrapping with Nim:
diff --git a/lib/pure/collections/tables.nim b/lib/pure/collections/tables.nim
index f817ec800..d1ed7586a 100644
--- a/lib/pure/collections/tables.nim
+++ b/lib/pure/collections/tables.nim
@@ -16,7 +16,7 @@
 ## ``shallowADT`` to compile a version that uses shallow copies instead.
 
 import
-  os, hashes, math
+  hashes, math
 
 when defined(shallowADT):
   {.pragma: myShallow, shallow.}
diff --git a/lib/system/assign.nim b/lib/system/assign.nim
index c71525a12..798409ba5 100755
--- a/lib/system/assign.nim
+++ b/lib/system/assign.nim
@@ -13,10 +13,9 @@ proc genericAssignAux(dest, src: Pointer, n: ptr TNimNode, shallow: bool) =
     d = cast[TAddress](dest)
     s = cast[TAddress](src)
   case n.kind
-  of nkNone: assert(false)
   of nkSlot:
-    genericAssignAux(cast[pointer](d +% n.offset), cast[pointer](s +% n.offset),
-                     n.typ, shallow)
+    genericAssignAux(cast[pointer](d +% n.offset), 
+                     cast[pointer](s +% n.offset), n.typ, shallow)
   of nkList:
     for i in 0..n.len-1:
       genericAssignAux(dest, src, n.sons[i], shallow)
@@ -25,6 +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)
 
 proc genericAssignAux(dest, src: Pointer, mt: PNimType, shallow: bool) =
   var
diff --git a/todo.txt b/todo.txt
index 06e46092c..a9f311dc1 100755
--- a/todo.txt
+++ b/todo.txt
@@ -15,7 +15,6 @@ High priority (version 0.9.0)
 - implement explicit varargs
 - tests: run modules that contain "#RUN_ME", compile the other
   modules; run the GC tests
-- fix implicit generic routines
 - fix the streams implementation so that it uses methods
 - fix overloading resolution
 - wrong co-/contravariance
@@ -30,6 +29,7 @@ Bugs
 - BUG: generic assign still buggy
   - Optimization: If we use a temporary for the result anyway the code gen
     should make use of this fact to generate better code...
+- bug: invoking a generic iterator twice triggers a code gen bug
 - sorting with leads to a strange memory corruption!
   --> 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
@@ -74,6 +74,7 @@ Low priority
 - 'nimrod def': does not always work
 - test branch coverage
 - checked exceptions
+- fix implicit generic routines
 
 
 Library