Index: compilers/imcc/instructions.c
===================================================================
--- compilers/imcc/instructions.c	(revision 21972)
+++ compilers/imcc/instructions.c	(working copy)
@@ -361,10 +361,13 @@
 
         unit->instructions = tmp;
         tmp->next = next;
-        next->prev = tmp;
-        tmp->line = next->line;
-        if (!next)
+        if (next) {
+            next->prev = tmp;
+            tmp->line = next->line;
+        }
+        else {
             unit->last_ins = tmp;
+        }
     }
     else {
         Instruction * const next = ins->next;
