diff --git a/bin/mktreeopt.pike b/bin/mktreeopt.pike
index ecf6269589258a724bb62f2d3b6e6c275d6529ea..3fab79763a511785c0472ddd2b996b232a4fec19 100644
--- a/bin/mktreeopt.pike
+++ b/bin/mktreeopt.pike
@@ -872,9 +872,9 @@ void parse_data()
       action = sprintf("#ifdef PIKE_DEBUG\n"
 		       "  if (l_flag > 4) {\n"
 		       "    fprintf(stderr,\n"
-		       "            \"Setting line position to %%s:%%d\\n\",\n"
+		       "            \"Setting line position to %%s:%%ld\\n\",\n"
 		       "            C%sR(n)->current_file->str,\n"
-		       "            C%sR(n)->line_number);\n"
+		       "            (long)C%sR(n)->line_number);\n"
 		       "  }\n"
 		       "#endif /* PIKE_DEBUG */\n"
 		       "c->lex.current_line = C%sR(n)->line_number;\n"
diff --git a/src/builtin.cmod b/src/builtin.cmod
index 5f856b6d51f9d6a076a988477cd1857c626e2698..48e241ba4a8e65370994b5e4e5654c6ce7d3565e 100644
--- a/src/builtin.cmod
+++ b/src/builtin.cmod
@@ -1023,7 +1023,7 @@ PIKEFUN string program_defined(program p)
   errname Program.defined;
   optflags OPT_TRY_OPTIMIZE;
 {
-  INT32 line;
+  INT_TYPE line;
   struct pike_string *tmp = low_get_program_line(p, &line);
 
   pop_n_elems(args);
@@ -1707,7 +1707,7 @@ PIKECLASS backtrace_frame
   /* These two are considered to be uninitialized from prog, pc and
    * fun as long as lineno == -1. */
   CVAR struct pike_string *filename;
-  CVAR INT32 lineno;
+  CVAR INT_TYPE lineno;
 
   INIT
   {
diff --git a/src/builtin_functions.c b/src/builtin_functions.c
index a0d7655901e8ecb1e9a5a83c822a81f929944fd9..ad5dd73c4448d8ef6b691e567850b2a7120ac7aa 100644
--- a/src/builtin_functions.c
+++ b/src/builtin_functions.c
@@ -8244,7 +8244,7 @@ PMOD_EXPORT void f__dmalloc_set_name(INT32 args)
 {
   char *s;
   INT_TYPE i;
-  extern char * dynamic_location(const char *file, int line);
+  extern char * dynamic_location(const char *file, INT_TYPE line);
   extern char * dmalloc_default_location;
 
   if(args)
@@ -9305,7 +9305,7 @@ PMOD_EXPORT void f_function_defined(INT32 args)
     struct program *id_prog, *p2;
     int func = SUBTYPEOF(Pike_sp[-args]);
     struct identifier *id;
-    INT32 line;
+    INT_TYPE line;
     struct pike_string *file = NULL;
 
     if (p == pike_trampoline_program) {
diff --git a/src/compilation.h b/src/compilation.h
index a743c8a0a5b5f11257f52c2546d4e231cbff6adf..15d62542526319a85a8cf20514e765449114bd55 100644
--- a/src/compilation.h
+++ b/src/compilation.h
@@ -149,7 +149,7 @@
 #endif
 
   SNAME(program_state,Pike_compiler)
-  ZMEMBER(INT32,last_line,0)
+  ZMEMBER(INT_TYPE,last_line,0)
   STRMEMBER(last_file,0)
   ZMEMBER(struct object *,fake_object,0)
   ZMEMBER(struct program *,new_program,0)
diff --git a/src/dmalloc.h b/src/dmalloc.h
index dc02d917893727e42f0bcae6b78fc5f36fd29195..9449032faacfac093f00dc67e323453b65b24d68 100644
--- a/src/dmalloc.h
+++ b/src/dmalloc.h
@@ -60,7 +60,7 @@ extern size_t dmalloc_tracelogptr;
 
 #ifdef PIKE_DEBUG
 PMOD_EXPORT extern int gc_external_refs_zapped;
-PMOD_EXPORT void gc_check_zapped (void *a, TYPE_T type, const char *file, int line);
+PMOD_EXPORT void gc_check_zapped (void *a, TYPE_T type, const char *file, INT_TYPE line);
 #endif
 
 #ifdef DO_PIKE_CLEANUP
@@ -107,11 +107,11 @@ PMOD_EXPORT int dmalloc_mark_as_free(void*,int);
 PMOD_EXPORT void *debug_malloc_update_location(void *, LOCATION);
 PMOD_EXPORT void *debug_malloc_update_location_ptr(void *, ptrdiff_t, LOCATION);
 PMOD_EXPORT void *debug_malloc_update_location_bt (void *p, const char *file,
-						   int line, const char *name);
+						   INT_TYPE line, const char *name);
 void search_all_memheaders_for_references(void);
 
 /* Beware! names of named memory regions are never ever freed!! /Hubbe */
-PMOD_EXPORT void *debug_malloc_name(void *p, const char *fn, int line);
+PMOD_EXPORT void *debug_malloc_name(void *p, const char *fn, INT_TYPE line);
 PMOD_EXPORT int debug_malloc_copy_names(void *p, void *p2);
 char *dmalloc_find_name(void *p);
 
@@ -174,7 +174,7 @@ void dmalloc_set_mmap(void *ptr, struct memory_map *m);
 void dmalloc_set_mmap_template(void *ptr, struct memory_map *m);
 void dmalloc_set_mmap_from_template(void *p, void *p2);
 void dmalloc_describe_location(void *p, int offset, int indent);
-struct memory_map *dmalloc_alloc_mmap(char *name, int line);
+struct memory_map *dmalloc_alloc_mmap(char *name, INT_TYPE line);
 void dmalloc_add_mmap_entry(struct memory_map *m,
 			    char *name,
 			    int offset,
diff --git a/src/docode.c b/src/docode.c
index 0ceb22d0b20f99c1bb462a9dcb5b8c3f2eb8f69a..19d1b630b60f6b73337072b2b40ee0509b0bfe73 100644
--- a/src/docode.c
+++ b/src/docode.c
@@ -44,7 +44,7 @@ struct statement_label_name
 {
   struct statement_label_name *next;
   struct pike_string *str;
-  unsigned int line_number;
+  INT_TYPE line_number;
 };
 
 struct statement_label
@@ -305,7 +305,7 @@ int do_docode(node *n, int flags)
   int i;
   int stack_depth_save = current_stack_depth;
   struct compilation *c = THIS_COMPILATION;
-  int save_current_line = c->lex.current_line;
+  INT_TYPE save_current_line = c->lex.current_line;
   if(!n) return 0;
   c->lex.current_line=n->line_number;
 #ifdef PIKE_DEBUG
@@ -2274,8 +2274,8 @@ static int do_docode2(node *n, int flags)
 
     label_found_1:
       if (n->token == F_CONTINUE && label->continue_label < 0) {
-	my_yyerror("Cannot continue the non-loop statement on line %d.",
-		   lbl_name->line_number);
+	my_yyerror("Cannot continue the non-loop statement on line %ld.",
+		   (long)lbl_name->line_number);
 	return 0;
       }
     }
@@ -2331,7 +2331,7 @@ static int do_docode2(node *n, int flags)
       struct statement_label_name *lbl_name;
       for (lbl_name = label->name; lbl_name; lbl_name = lbl_name->next)
 	if (lbl_name->str == name.str) {
-	  INT32 save_line = c->lex.current_line;
+	  INT_TYPE save_line = c->lex.current_line;
 	  c->lex.current_line = name.line_number;
 	  my_yyerror("Duplicate nested labels, previous one on line %d.",
 		     lbl_name->line_number);
diff --git a/src/encode.c b/src/encode.c
index 78f4877adc496a888a750f754a3ac8e9d64dd746..a52fa137a1757997d5c90818b661145f38317ae7 100644
--- a/src/encode.c
+++ b/src/encode.c
@@ -2562,7 +2562,7 @@ static INT32 decode_portable_bytecode(struct decode_data *data, INT32 string_no)
   struct program *p = Pike_compiler->new_program;
   struct pike_string *bytecode;
   struct pike_string *current_file=NULL;
-  INT32 current_line=0;
+  INT_TYPE current_line = 0;
   int e;
   ONERROR err;
 
@@ -2602,7 +2602,9 @@ static INT32 decode_portable_bytecode(struct decode_data *data, INT32 string_no)
 	}						\
 	current_file = p->strings[strno];		\
       } else if (STR(bytecode)[e] == F_LINE) {		\
-	current_line = STR(bytecode)[e+1];		\
+	current_line =					\
+	  ((unsigned INT32)STR(bytecode)[e+1]) |	\
+	  ((INT_TYPE)STR(bytecode)[e+2])<<32;		\
       } else if (!current_file) {			\
 	decode_error(data, NULL, "Missing filename directive in "	\
 		     "byte code.\n");			\
@@ -3866,7 +3868,7 @@ static void decode_value2(struct decode_data *data)
 	  struct compilation *c;
 	  struct pike_string *save_current_file;
 	  struct object *placeholder = NULL;
-	  unsigned INT32 save_current_line;
+	  INT_TYPE save_current_line;
 #define FOO(NUMTYPE,Y,ARGTYPE,NAME) \
           NUMTYPE PIKE_CONCAT(local_num_, NAME) = 0;
 #include "program_areas.h"
@@ -4366,19 +4368,19 @@ static void decode_value2(struct decode_data *data)
 		decode_number(no, data);
 
 		EDB(5, {
-		  INT32 line;
+		  INT_TYPE line;
 		  struct pike_string *file =
 		    get_line(func.offset + p->program, p, &line);
 		  fprintf(stderr,
 			  "%*sdefine_function(\"%s\", X, 0x%04x, 0x%04x,\n"
 			  "%*s                0x%04x, 0x%04x)\n"
-			  "%*s    @ %s:%d\n",
+			  "%*s    @ %s:%ld\n",
 			  data->depth, "",
 			  Pike_sp[-2].u.string->str, id_flags, func_flags,
 			  data->depth, "",
 			  func.offset, opt_flags,
 			  data->depth, "",
-			  file->str, line);
+			  file->str, (long)line);
 		});
 
 		/* Alters
diff --git a/src/error.c b/src/error.c
index 9980587afa771dcbca774ab0fae4483c807f5a55..928cd89792653fb709b875acacf112c010c2518e 100644
--- a/src/error.c
+++ b/src/error.c
@@ -31,7 +31,7 @@
 /* #define ERROR_DEBUG */
 
 PMOD_EXPORT const char msg_fatal_error[] =
-  "%s:%d: Fatal error:\n";
+  "%s:%ld: Fatal error:\n";
 #ifdef PIKE_DEBUG
 PMOD_EXPORT const char msg_unsetjmp_nosync_1[] =
   "UNSETJMP out of sync! (last SETJMP at %s)!\n";
diff --git a/src/gc.c b/src/gc.c
index 5f1646f3fdd404d4a2662ef3efa70ce015d27372..80d65343259a2e936e5c40556142b0ffed048283 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -1039,11 +1039,11 @@ void debug_gc_fatal_2 (void *a, int type, int flags, const char *fmt, ...)
   va_end (args);
 }
 
-static void dloc_gc_fatal (const char *file, int line,
+static void dloc_gc_fatal (const char *file, INT_TYPE line,
 			   void *a, int flags, const char *fmt, ...)
 {
   va_list args;
-  fprintf (stderr, "%s:%d: GC fatal:\n", file, line);
+  fprintf (stderr, "%s:%ld: GC fatal:\n", file, (long)line);
   va_start (args, fmt);
   debug_gc_fatal_va (a, PIKE_T_UNKNOWN, flags, fmt, args);
   va_end (args);
@@ -1052,7 +1052,7 @@ static void dloc_gc_fatal (const char *file, int line,
 static void rec_stack_fatal (struct gc_rec_frame *err, const char *err_name,
 			     struct gc_rec_frame *p1, const char *p1n,
 			     struct gc_rec_frame *p2, const char *p2n,
-			     const char *file, int line,
+			     const char *file, INT_TYPE line,
 			     const char *fmt, ...)
 {
   va_list args;
@@ -1179,7 +1179,7 @@ again:
 	struct object *o = t->frame->current_object;
 	struct program *p = o->prog;
 	struct identifier *id;
-	INT32 line;
+	INT_TYPE line;
 	struct pike_string *file;
 
 	fprintf (stderr, "%*s**The object is a trampoline.\n", indent, "");
@@ -1306,7 +1306,7 @@ again:
     case T_PROGRAM:
     {
       char *tmp;
-      INT32 line;
+      INT_TYPE line;
       ptrdiff_t id_idx, id_count = 0;
       struct inherit *inh = p->inherits, *next_inh = p->inherits + 1;
       ptrdiff_t inh_id_end = p->num_identifier_references;
@@ -1555,7 +1555,7 @@ again:
 	  struct program *p = f->current_object->prog;
 	  if (p) {
 	    struct identifier *id = ID_FROM_INT(p, f->fun);
-	    INT32 line;
+	    INT_TYPE line;
 	    struct pike_string *file;
 	    if (IDENTIFIER_IS_PIKE_FUNCTION(id->identifier_flags) &&
 		id->func.offset >= 0 &&
@@ -2045,12 +2045,12 @@ void exit_gc(void)
 
 #ifdef PIKE_DEBUG
 
-PMOD_EXPORT void gc_check_zapped (void *a, TYPE_T type, const char *file, int line)
+PMOD_EXPORT void gc_check_zapped (void *a, TYPE_T type, const char *file, INT_TYPE line)
 {
   struct marker *m = find_marker (a);
   if (m && (m->flags & GC_CLEANUP_LEAKED))
-    fprintf (stderr, "Free of leaked %s %p from %s:%d, %d refs remaining\n",
-	     get_name_of_type (type), a, file, line, *(INT32 *)a - 1);
+    fprintf (stderr, "Free of leaked %s %p from %s:%ld, %d refs remaining\n",
+	     get_name_of_type (type), a, file, (long)line, *(INT32 *)a - 1);
 }
 
 /* This function marks some known externals. The rest are handled by
@@ -2255,7 +2255,7 @@ int gc_mark_external (void *a, const char *place)
 static void check_rec_stack_frame (struct gc_rec_frame *f,
 				   struct gc_rec_frame *p1, const char *p1n,
 				   struct gc_rec_frame *p2, const char *p2n,
-				   const char *file, int line)
+				   const char *file, INT_TYPE line)
 {
   /* To allow this function to be used after a stack rotation but
    * before cycle_id markup, there are no checks here for cycle_id
@@ -2302,7 +2302,7 @@ static void check_rec_stack_frame (struct gc_rec_frame *f,
   while (0)
 
 static void check_cycle_piece_frame (struct gc_rec_frame *f,
-				     const char *file, int line)
+				     const char *file, INT_TYPE line)
 {
   LOW_CHECK_REC_FRAME (f, file, line);
   if ((f->rf_flags & (GC_ON_CYCLE_PIECE_LIST|GC_ON_KILL_LIST)) !=
@@ -2318,7 +2318,7 @@ static void check_cycle_piece_frame (struct gc_rec_frame *f,
   do check_cycle_piece_frame ((f), __FILE__, __LINE__); while (0)
 
 static void check_kill_list_frame (struct gc_rec_frame *f,
-				   const char *file, int line)
+				   const char *file, INT_TYPE line)
 {
   LOW_CHECK_REC_FRAME (f, file, line);
   if ((f->rf_flags & (GC_ON_CYCLE_PIECE_LIST|GC_ON_KILL_LIST)) !=
@@ -3815,7 +3815,7 @@ size_t do_gc(void *ignored, int explicit_call)
       GC_VERBOSE_DO(
 	fprintf(stderr, "|   Killing %p with %d refs", o, o->refs);
 	if (o->prog) {
-	  INT32 line;
+	  INT_TYPE line;
 	  struct pike_string *file = get_program_line (o->prog, &line);
 	  fprintf(stderr, ", prog %s:%d\n", file->str, line);
 	  free_string(file);
@@ -4805,10 +4805,10 @@ static int mc_cycle_depth_from_obj (struct object *o)
 
   if (TYPEOF(val) != T_INT) {
     int i = find_shared_string_identifier (pike_cycle_depth_str.u.string, p);
-    INT32 line;
+    INT_TYPE line;
     struct pike_string *file = get_identifier_line (p, i, &line);
-    make_error ("Object got non-integer pike_cycle_depth %O at %S:%d.\n",
-		&val, file, line);
+    make_error ("Object got non-integer pike_cycle_depth %O at %S:%ld.\n",
+		&val, file, (long)line);
     free_svalue (&val);
     free_svalue (&throw_value);
     move_svalue (&throw_value, --Pike_sp);
@@ -4823,10 +4823,10 @@ static int mc_cycle_depth_from_obj (struct object *o)
 
   if (val.u.integer < 0) {
     int i = find_shared_string_identifier (pike_cycle_depth_str.u.string, p);
-    INT32 line;
+    INT_TYPE line;
     struct pike_string *file = get_identifier_line (p, i, &line);
-    make_error ("Object got negative pike_cycle_depth at %S:%d.\n",
-		&val, file, line);
+    make_error ("Object got negative pike_cycle_depth at %S:%ld.\n",
+		&val, file, (long)line);
     free_svalue (&throw_value);
     move_svalue (&throw_value, --Pike_sp);
     return -1;
diff --git a/src/interpret.c b/src/interpret.c
index e2cb5eb9ab59149e61efe2c08bb9c0b621f12810..41b9f412c5d93462c5b2fa57b7461e907b0e0fa4 100644
--- a/src/interpret.c
+++ b/src/interpret.c
@@ -885,7 +885,7 @@ static INLINE void low_debug_instr_prologue (PIKE_INSTR_T instr)
   {
     char *file = NULL, *f;
     struct pike_string *filep;
-    INT32 linep;
+    INT_TYPE linep;
 
     filep = get_line(Pike_fp->pc,Pike_fp->context->prog,&linep);
     if (filep && !filep->size_shift) {
@@ -1026,7 +1026,7 @@ void dump_backlog(void)
     if (p)
     {
       struct pike_string *file;
-      INT32 line;
+      INT_TYPE line;
 
 #ifdef _REENTRANT
       if(thread != backlog[e].thread_state)
@@ -1738,7 +1738,8 @@ static void do_trace_call(INT32 args, dynamic_buffer *old_buf)
 {
   struct pike_string *filep = NULL;
   char *file, *s;
-  INT32 linep,e;
+  INT_TYPE linep;
+  INT32 e;
   ptrdiff_t len = 0;
 
   my_strcat("(");
@@ -1825,7 +1826,7 @@ static void do_trace_return (int got_retval, dynamic_buffer *old_buf)
 {
   struct pike_string *filep = NULL;
   char *file, *s;
-  INT32 linep;
+  INT_TYPE linep;
 
   if (got_retval) {
     my_strcat ("returns: ");
@@ -3052,7 +3053,7 @@ void gdb_backtrace (
     if (f->refs) {
       int args, i;
       char *file = NULL;
-      INT32 line;
+      INT_TYPE line;
 
       if (f->context) {
 	if (f->pc)
@@ -3061,7 +3062,7 @@ void gdb_backtrace (
 	  file = low_get_program_line_plain (f->context->prog, &line, 0);
       }
       if (file)
-	fprintf (stderr, "%s:%d: ", file, line);
+	fprintf (stderr, "%s:%ld: ", file, (long)line);
       else
 	fputs ("unknown program: ", stderr);
 
@@ -3173,7 +3174,7 @@ void gdb_backtrace (
 	    struct program *p = arg->u.object->prog;
 	    if (p && p->num_linenumbers) {
 	      file = low_get_program_line_plain (p, &line, 0);
-	      fprintf (stderr, "object(%s:%d)", file, line);
+	      fprintf (stderr, "object(%s:%ld)", file, (long)line);
 	    }
 	    else
 	      fputs ("object", stderr);
@@ -3184,7 +3185,7 @@ void gdb_backtrace (
 	    struct program *p = arg->u.program;
 	    if (p->num_linenumbers) {
 	      file = low_get_program_line_plain (p, &line, 0);
-	      fprintf (stderr, "program(%s:%d)", file, line);
+	      fprintf (stderr, "program(%s:%ld)", file, (long)line);
 	    }
 	    else
 	      fputs ("program", stderr);
@@ -3233,7 +3234,7 @@ void gdb_backtraces()
   struct thread_state *ts = 0;
   while ((i = gdb_next_thread_state (i, &ts)), ts) {
     fprintf (stderr, "\nTHREAD_ID %p (swapped %s):\n",
-	     (void *)ts->id, ts->swapped ? "out" : "in");
+	     (void *)(ptrdiff_t)ts->id, ts->swapped ? "out" : "in");
     gdb_backtrace (ts->id);
   }
 #else
diff --git a/src/las.c b/src/las.c
index 18929a432a0ebe83be807510d5b96e64b81865bc..0969997d97a83bd23f196d4e5bbe85a75b520b3a 100644
--- a/src/las.c
+++ b/src/las.c
@@ -446,8 +446,9 @@ void free_all_nodes(void)
 #ifdef PIKE_DEBUG
 	      if(!cumulative_parse_error)
 	      {
-		fprintf(stderr,"Free node at %p, (%s:%d) (token=%d).\n",
-			(void *)tmp, tmp->current_file->str, tmp->line_number,
+		fprintf(stderr,"Free node at %p, (%s:%ld) (token=%d).\n",
+			(void *)tmp,
+			tmp->current_file->str, (long)tmp->line_number,
 			tmp->token);
 
 		debug_malloc_dump_references(tmp,0,2,0);
@@ -3557,8 +3558,8 @@ void fix_type_field(node *n)
 
 #ifdef PIKE_DEBUG
       if (l_flag>2)
-	safe_pike_fprintf (stderr, "Checking call to %S at %S:%d.\n", name,
-			   n->current_file, n->line_number);
+	safe_pike_fprintf (stderr, "Checking call to %S at %S:%ld.\n", name,
+			   n->current_file, (long)n->line_number);
 #endif /* PIKE_DEBUG */
 
       /* NOTE: new_check_call() steals a reference from f! */
@@ -5062,7 +5063,7 @@ static void optimize(node *n)
   struct compilation *c = THIS_COMPILATION;
   struct pike_string *save_file =
     dmalloc_touch(struct pike_string *, c->lex.current_file);
-  INT32 save_line = c->lex.current_line;
+  INT_TYPE save_line = c->lex.current_line;
 
   do
   {
@@ -5584,9 +5585,9 @@ int dooptcode(struct pike_string *name,
 	  struct compilation *c = THIS_COMPILATION;
 
 	  if(a_flag > 1)
-	    fprintf(stderr,"%s:%d: IDENTIFIER OPTIMIZATION %s == %s\n",
+	    fprintf(stderr,"%s:%ld: IDENTIFIER OPTIMIZATION %s == %s\n",
 		    c->lex.current_file->str,
-		    c->lex.current_line,
+		    (long)c->lex.current_line,
 		    name->str,
 		    foo->u.efun->name->str);
 #endif
diff --git a/src/las.h b/src/las.h
index 4c7e00eedff5e9225fc45121009ae827c245d70e..2bbfc8d1f726212d5734f929bc008b14d2b30ca5 100644
--- a/src/las.h
+++ b/src/las.h
@@ -113,9 +113,10 @@ struct node_s
   struct pike_type *type;
   struct pike_string *name;
   struct node_s *parent;
-  unsigned INT16 line_number;
+  INT_TYPE line_number;
   unsigned INT16 node_info;
   unsigned INT16 tree_info;
+  unsigned INT16 pad;
   /* The stuff from this point on is hashed. */
   unsigned INT16 token;
   union node_data u;
diff --git a/src/lex.h b/src/lex.h
index 52b6a313e7b392d26e2349d1ddac1c6e871ec91b..603589c82d9d4c8aa4d65650ea8c4951f81b97be 100644
--- a/src/lex.h
+++ b/src/lex.h
@@ -22,7 +22,7 @@ struct lex
 {
   char *pos;
   char *end;
-  INT32 current_line;
+  INT_TYPE current_line;
   INT32 pragmas;
   struct pike_string *current_file;
   int (*current_lexer)(struct lex *, YYSTYPE *);
diff --git a/src/lexer.h b/src/lexer.h
index be112888bc7a06b5a36b653e3c4f902ff691b9ec..45bac31f7399ff099fea907a1e5adeefa3adc942 100644
--- a/src/lexer.h
+++ b/src/lexer.h
@@ -705,7 +705,7 @@ static int low_yylex(struct lex *lex, YYSTYPE *yylval)
       {
       case '0': case '1': case '2': case '3': case '4':
       case '5': case '6': case '7': case '8': case '9':
-	lex->current_line=lex_atoi(buf)-1;
+	lex->current_line = lex_strtol(buf, NULL, 10)-1;
 	SKIPSPACE();
 	if(GOBBLE('"'))
 	{
diff --git a/src/operators.c b/src/operators.c
index 383b4b71030a8a6cacf515e93feac89d27045fd5..e1db215e5d3071378260a4e91bad8b5a4ce76799 100644
--- a/src/operators.c
+++ b/src/operators.c
@@ -611,7 +611,7 @@ PMOD_EXPORT void o_cast(struct pike_type *type, INT32 run_time_type)
 	{
 	  case T_STRING: {
 	    struct pike_string *file;
-	    INT32 lineno;
+	    INT_TYPE lineno;
 	    if(Pike_fp->pc &&
 	       (file = low_get_line(Pike_fp->pc, Pike_fp->context->prog, &lineno))) {
 	      push_string(file);
@@ -649,7 +649,7 @@ PMOD_EXPORT void o_cast(struct pike_type *type, INT32 run_time_type)
       {
 	case T_STRING: {
 	  struct pike_string *file;
-	  INT32 lineno;
+	  INT_TYPE lineno;
 	  if(Pike_fp->pc &&
 	     (file = low_get_line(Pike_fp->pc, Pike_fp->context->prog, &lineno))) {
 	    push_string(file);
diff --git a/src/peep.c b/src/peep.c
index bee85f67b797905e8f80238dc266ead1bf55a6ba..9d6cde8e271a8b5fb02ecbdb7ddd648cefcd2569 100644
--- a/src/peep.c
+++ b/src/peep.c
@@ -97,7 +97,7 @@ ptrdiff_t insert_opcode(p_instr *opcode)
 ptrdiff_t insert_opcode2(unsigned int f,
 			 INT32 b,
 			 INT32 c,
-			 INT32 current_line,
+			 INT_TYPE current_line,
 			 struct pike_string *current_file)
 {
   p_instr *p;
@@ -128,7 +128,7 @@ ptrdiff_t insert_opcode2(unsigned int f,
 
 ptrdiff_t insert_opcode1(unsigned int f,
 			 INT32 b,
-			 INT32 current_line,
+			 INT_TYPE current_line,
 			 struct pike_string *current_file)
 {
 #ifdef PIKE_DEBUG
@@ -139,7 +139,8 @@ ptrdiff_t insert_opcode1(unsigned int f,
   return insert_opcode2(f,b,0,current_line,current_file);
 }
 
-ptrdiff_t insert_opcode0(int f,int current_line, struct pike_string *current_file)
+ptrdiff_t insert_opcode0(int f, INT_TYPE current_line,
+			 struct pike_string *current_file)
 {
 #ifdef PIKE_DEBUG
   if(hasarg(f))
@@ -192,7 +193,7 @@ INT32 assemble(int store_linenumbers)
   {
     for (e = 0; e < length; e++) {
       if (c[e].opcode == F_POP_SYNCH_MARK) synch_depth--;
-      fprintf(stderr, "~~~%4d %4lx %*s", c[e].line,
+      fprintf(stderr, "~~~%4ld %4lx %*s", (long)c[e].line,
 	      DO_NOT_WARN((unsigned long)e), synch_depth, "");
       dump_instr(c+e);
       fprintf(stderr,"\n");
@@ -209,7 +210,7 @@ INT32 assemble(int store_linenumbers)
   if (store_linenumbers) {
     p_wchar2 *current_tripple;
     struct pike_string *previous_file = NULL;
-    int previous_line = 0;
+    INT_TYPE previous_line = 0;
     ptrdiff_t num_linedirectives = 0;
 
     /* Count the number of F_FILENAME/F_LINE pseudo-ops we need to add. */
@@ -252,7 +253,7 @@ INT32 assemble(int store_linenumbers)
       if (c[e].line != previous_line) {
 	current_tripple[0] = F_LINE;
 	current_tripple[1] = c[e].line;
-	current_tripple[2] = 0;
+	current_tripple[2] = c[e].line>>32;
 	current_tripple += 3;
 	previous_line = c[e].line;
       }
@@ -296,8 +297,8 @@ INT32 assemble(int store_linenumbers)
     c=(p_instr *)instrbuf.s.str;
     for(e=0;e<length;e++,c++) {
       if (c->opcode == F_POP_SYNCH_MARK) synch_depth--;
-      fprintf(stderr, " * %4d %4lx ",
-	      c->line, DO_NOT_WARN((unsigned long)e));
+      fprintf(stderr, " * %4ld %4lx ",
+	      (long)c->line, DO_NOT_WARN((unsigned long)e));
       dump_instr(c);
       if ((instrs[c->opcode - F_OFFSET].flags & I_POINTER) &&
 	  (c->arg > max_label)) {
@@ -496,7 +497,7 @@ INT32 assemble(int store_linenumbers)
     if((a_flag > 2 && store_linenumbers) || a_flag > 3)
     {
       if (c->opcode == F_POP_SYNCH_MARK) synch_depth--;
-      fprintf(stderr, "===%4d %4lx %*s", c->line,
+      fprintf(stderr, "===%4ld %4lx %*s", (long)c->line,
 	      DO_NOT_WARN((unsigned long)PIKE_PC), synch_depth, "");
       dump_instr(c);
       fprintf(stderr,"\n");
@@ -805,7 +806,7 @@ static p_instr *instructions;
 /* insopt{0,1,2} push an instruction on instrstack. */
 
 static INLINE p_instr *insopt2(int f, INT32 a, INT32 b,
-			       int cl, struct pike_string *cf)
+			       INT_TYPE cl, struct pike_string *cf)
 {
   p_instr *p;
 
@@ -831,7 +832,8 @@ static INLINE p_instr *insopt2(int f, INT32 a, INT32 b,
   return p;
 }
 
-static INLINE p_instr *insopt1(int f, INT32 a, int cl, struct pike_string *cf)
+static INLINE p_instr *insopt1(int f, INT32 a, INT_TYPE cl,
+			       struct pike_string *cf)
 {
 #ifdef PIKE_DEBUG
   if(!hasarg(f) && a)
@@ -841,7 +843,7 @@ static INLINE p_instr *insopt1(int f, INT32 a, int cl, struct pike_string *cf)
   return insopt2(f,a,0,cl, cf);
 }
 
-static INLINE p_instr *insopt0(int f, int cl, struct pike_string *cf)
+static INLINE p_instr *insopt0(int f, INT_TYPE cl, struct pike_string *cf)
 {
 #ifdef PIKE_DEBUG
   if(hasarg(f))
@@ -945,13 +947,13 @@ static void do_optimization(int topop, int topush, ...)
   int q=0;
   int oplen;
   struct pike_string *cf;
-  INT32 cl=instr(0)->line;
+  INT_TYPE cl=instr(0)->line;
 
 #ifdef PIKE_DEBUG
   if(a_flag>5)
   {
     int e;
-    fprintf(stderr,"PEEP at %d:",cl);
+    fprintf(stderr, "PEEP at %ld:", cl);
     for(e = topop; e--;)
     {
       fprintf(stderr," ");
@@ -1064,7 +1066,7 @@ static int asm_opt(void)
     for(e=0;e<length;e++,c++)
     {
       if (c->opcode == F_POP_SYNCH_MARK) synch_depth--;
-      fprintf(stderr,"<<<%4d: %*s",c->line,synch_depth,"");
+      fprintf(stderr,"<<<%4ld: %*s",(long)c->line,synch_depth,"");
       dump_instr(c);
       fprintf(stderr,"\n");
       if (c->opcode == F_SYNCH_MARK) synch_depth++;
@@ -1113,7 +1115,7 @@ static int asm_opt(void)
     for(e=0;e<length;e++,c++)
     {
       if (c->opcode == F_POP_SYNCH_MARK) synch_depth--;
-      fprintf(stderr,">>>%4d: %*s",c->line,synch_depth,"");
+      fprintf(stderr,">>>%4ld: %*s",(long)c->line,synch_depth,"");
       dump_instr(c);
       fprintf(stderr,"\n");
       if (c->opcode == F_SYNCH_MARK) synch_depth++;
diff --git a/src/peep.h b/src/peep.h
index 8517d072bb14830601c953e8c55600458cf2b1c9..a69c93752d2a9dcccd60889c90874e9ddf392a45 100644
--- a/src/peep.h
+++ b/src/peep.h
@@ -13,7 +13,7 @@ extern dynamic_buffer instrbuf;
 struct p_instr_s
 {
   short opcode;
-  short line;
+  INT_TYPE line;
   struct pike_string *file;
   INT32 arg;
   INT32 arg2;
@@ -27,13 +27,13 @@ void exit_bytecode(void);
 ptrdiff_t insert_opcode2(unsigned int f,
 			 INT32 a,
 			 INT32 b,
-			 INT32 current_line,
+			 INT_TYPE current_line,
 			 struct pike_string *current_file);
 ptrdiff_t insert_opcode1(unsigned int f,
 			 INT32 a,
-			 INT32 current_line,
+			 INT_TYPE current_line,
 			 struct pike_string *current_file);
-ptrdiff_t insert_opcode0(int f,int current_line,
+ptrdiff_t insert_opcode0(int f, INT_TYPE current_line,
 			 struct pike_string *current_file);
 void update_arg(int instr,INT32 arg);
 INT32 assemble(int store_linenumbers);
diff --git a/src/pike_memory.c b/src/pike_memory.c
index 4524b20018a86a2ecf3df999cf41ca88c3f2d4df..ade6292e17f7022b20766f59f3e3a4187222f876 100644
--- a/src/pike_memory.c
+++ b/src/pike_memory.c
@@ -638,41 +638,41 @@ static struct mexec_hdr {
 
 #ifdef PIKE_DEBUG
 static void low_verify_mexec_hdr(struct mexec_hdr *hdr,
-				 const char *file, int line)
+				 const char *file, INT_TYPE line)
 {
   struct mexec_free_block *ptr;
   char *blk_ptr;
   if (!hdr) return;
   if (d_flag) {
     if (hdr->bottom > ((char *)hdr) + hdr->size) {
-      Pike_fatal("%s:%d:Bad bottom %p > %p\n",
-		 file, line,
+      Pike_fatal("%s:%ld:Bad bottom %p > %p\n",
+		 file, (long)line,
 		 hdr->bottom, ((char *)hdr) + hdr->size);
     }
     for (blk_ptr = (char *)(hdr+1); blk_ptr < hdr->bottom;) {
       struct mexec_free_block *blk = (struct mexec_free_block *)blk_ptr;
       if (blk->size <= 0) {
-	Pike_fatal("%s:%d:Bad block size: %p\n",
-		   file, line,
+	Pike_fatal("%s:%ld:Bad block size: %p\n",
+		   file, (long)line,
 		   (void *)blk->size);
       }
       blk_ptr += blk->size;
     }
     if (blk_ptr != hdr->bottom) {
-      Pike_fatal("%s:%d:Block reaches past bottom! %p > %p\n",
-		 file, line,
+      Pike_fatal("%s:%ld:Block reaches past bottom! %p > %p\n",
+		 file, (long)line,
 		 blk_ptr, hdr->bottom);
     }
     if (d_flag > 1) {
       for (ptr = hdr->free; ptr; ptr = ptr->next) {
 	if (ptr < (struct mexec_free_block *)(hdr+1)) {
-	  Pike_fatal("%s:%d:Free block before start of header. %p < %p\n",
-		     file, line,
+	  Pike_fatal("%s:%ld:Free block before start of header. %p < %p\n",
+		     file, (long)line,
 		     ptr, hdr+1);
 	}
 	if (((char *)ptr) >= hdr->bottom) {
-	  Pike_fatal("%s:%d:Free block past bottom. %p >= %p\n",
-		     file, line,
+	  Pike_fatal("%s:%ld:Free block past bottom. %p >= %p\n",
+		     file, (long)line,
 		     ptr, hdr->bottom);
 	}
       }
@@ -2424,7 +2424,7 @@ struct parsed_location
 {
   const char *file;
   size_t file_len;
-  int line;
+  INT_TYPE line;
   const char *extra;
 };
 
@@ -2443,7 +2443,7 @@ static void parse_location (struct memloc *l, struct parsed_location *pl)
   if (p && p < pl->extra) {
     const char *pp;
     while ((pp = STRCHR (p + 1, ':')) && pp < pl->extra) p = pp;
-    pl->line = atoi (p + 1);
+    pl->line = STRTOL (p + 1, NULL, 10);
     pl->file_len = p - pl->file;
   }
   else {
@@ -3043,7 +3043,8 @@ struct dmalloc_string
 
 static struct dmalloc_string *dstrhash[DSTRHSIZE];
 
-static LOCATION low_dynamic_location(char type, const char *file, int line,
+static LOCATION low_dynamic_location(char type, const char *file,
+				     INT_TYPE line,
 				     const char *name,
 				     const unsigned char *bin_data,
 				     unsigned int bin_data_len)
@@ -3069,7 +3070,7 @@ static LOCATION low_dynamic_location(char type, const char *file, int line,
        !STRNCMP(str->str+1, file, len) &&
        str->str[len+1]==':' &&
        LOCATION_TYPE (str->str) == type &&
-       atoi(str->str+len+2) == line)
+       STRTOL(str->str+len+2, NULL, 10) == line)
     {
 
       if (name) {
@@ -3103,7 +3104,7 @@ static LOCATION low_dynamic_location(char type, const char *file, int line,
     char line_str[30];
     size_t l;
 
-    sprintf (line_str, "%d", line);
+    sprintf (line_str, "%ld", (long)line);
     l = len + strlen (line_str) + 2;
     if (name) l += name_len + 1;
     str=malloc (sizeof (struct dmalloc_string) + l +
@@ -3133,13 +3134,13 @@ static LOCATION low_dynamic_location(char type, const char *file, int line,
   return str->str;
 }
 
-LOCATION dynamic_location(const char *file, int line)
+LOCATION dynamic_location(const char *file, INT_TYPE line)
 {
   return low_dynamic_location('D',file,line, NULL, NULL, 0);
 }
 
 
-PMOD_EXPORT void * debug_malloc_name(void *p,const char *file, int line)
+PMOD_EXPORT void * debug_malloc_name(void *p,const char *file, INT_TYPE line)
 {
   if(p)
   {
@@ -3214,7 +3215,8 @@ char *dmalloc_find_name(void *p)
 }
 
 PMOD_EXPORT void *debug_malloc_update_location_bt (void *p, const char *file,
-						   int line, const char *name)
+						   INT_TYPE line,
+						   const char *name)
 {
   LOCATION l;
 #ifdef DMALLOC_C_STACK_TRACE
@@ -3419,7 +3421,7 @@ void dmalloc_describe_location(void *p, int offset, int indent)
   }
 }
 
-struct memory_map *dmalloc_alloc_mmap(char *name, int line)
+struct memory_map *dmalloc_alloc_mmap(char *name, INT_TYPE line)
 {
   struct memory_map *m;
   mt_lock(&debug_malloc_mutex);
@@ -3431,7 +3433,7 @@ struct memory_map *dmalloc_alloc_mmap(char *name, int line)
   m->refs=0;
 
   if(strlen(m->name)+12<sizeof(m->name))
-    sprintf(m->name+strlen(m->name),":%d",line);
+    sprintf(m->name+strlen(m->name), ":%ld", (long)line);
 
   m->entries=0;
   mt_unlock(&debug_malloc_mutex);
diff --git a/src/program.c b/src/program.c
index 8488fe79291d27b7b3fb7b57a778b802847698bf..bbfa2e37020a0889a6d6cb950ecf924ef2c92792 100644
--- a/src/program.c
+++ b/src/program.c
@@ -1338,7 +1338,7 @@ static struct program *gc_mark_program_pos = 0;
 #define CHECK_FILE_ENTRY(PROG, POS, LEN, SHIFT) do {} while (0)
 #endif
 
-int get_small_number(char **q);
+INT_TYPE get_small_number(char **q);
 
 PMOD_EXPORT void do_free_program (struct program *p)
 {
@@ -2144,9 +2144,9 @@ static int program_identifier_index_compare(int a, int b,
 #undef CMP
 
 #ifdef PIKE_DEBUG
-struct pike_string *find_program_name(struct program *p, INT32 *line)
+struct pike_string *find_program_name(struct program *p, INT_TYPE *line)
 {
-  INT32 l;
+  INT_TYPE l;
   if(!line) line=&l;
 
 #ifdef DEBUG_MALLOC
@@ -2502,7 +2502,7 @@ void fixate_program(void)
   {
 #define DBSTR(X) ((X)?(X)->str:"")
     int e,v;
-    INT32 line;
+    INT_TYPE line;
     struct pike_string *tmp;
     struct memory_map *m=0;;
     if(c->lex.current_file && 
@@ -2775,7 +2775,8 @@ void low_start_new_program(struct program *p,
 #include "program_areas.h"
 
     {
-      INT32 line=0, off=0;
+      INT_TYPE line = 0;
+      INT32 off = 0;
       size_t len = 0;
       INT32 shift = 0;
       char *file=0;
@@ -2857,10 +2858,10 @@ void low_start_new_program(struct program *p,
   debug_malloc_touch(Pike_compiler->fake_object->storage);
 }
 
-PMOD_EXPORT void debug_start_new_program(int line, const char *file)
+PMOD_EXPORT void debug_start_new_program(INT_TYPE line, const char *file)
 {
   struct pike_string *save_file;
-  int save_line;
+  INT_TYPE save_line;
   struct compilation *c;
 
   CHECK_COMPILER();
@@ -2879,9 +2880,9 @@ PMOD_EXPORT void debug_start_new_program(int line, const char *file)
   }
 
   CDFPRINTF((stderr,
-	     "th(%ld) start_new_program(%d, %s): "
+	     "th(%ld) start_new_program(%ld, %s): "
 	     "threads_disabled:%d, compilation_depth:%d\n",
-	     (long)th_self(), line, file,
+	     (long)th_self(), (long)line, file,
 	     threads_disabled, c->compilation_depth));
 
   low_start_new_program(0,1,0,0,0);
@@ -3210,13 +3211,14 @@ void dump_program_tables (const struct program *p, int indent)
 
     fprintf(stderr,
 	    "%*s  %4d: %5x %7d %10d  %s\n"
-	    "%*s        %s:%d\n",
+	    "%*s        %s:%ld\n",
 	    indent, "",
 	    d, ref->id_flags, ref->inherit_offset,
 	    ref->identifier_offset,
 	    id->name->size_shift ? "(wide)" : id->name->str,
 	    indent, "",
-	    p->num_strings?p->strings[id->filename_strno]->str:"-", id->linenumber);
+	    p->num_strings?p->strings[id->filename_strno]->str:"-",
+	    (long)id->linenumber);
     if (IDENTIFIER_IS_ALIAS(id->identifier_flags)) {
       fprintf (stderr, "%*s                                  Alias for %d:%d\n",
 	       indent, "", id->func.ext_ref.depth, id->func.ext_ref.id);
@@ -3227,13 +3229,13 @@ void dump_program_tables (const struct program *p, int indent)
       fprintf (stderr, "%*s                                  Offset: 0x%08lx\n",
 	       indent, "", (long)id->func.offset);
     } else if (IDENTIFIER_IS_PIKE_FUNCTION(id->identifier_flags)) {
-      INT32 line;
+      INT_TYPE line;
       struct program *inh_p = INHERIT_FROM_PTR(p,ref)->prog;
       struct pike_string *file =
 	get_line (ID_FROM_PTR(p,ref)->func.offset + inh_p->program, inh_p, &line);
       if (!file->size_shift)
-	fprintf (stderr, "%*s                                  %s:%d\n",
-		 indent, "", file->str, line);
+	fprintf (stderr, "%*s                                  %s:%ld\n",
+		 indent, "", file->str, (long)line);
       free_string (file);
     } else {
       fprintf (stderr, "%*s                                  Cfun: %p\n",
@@ -3279,12 +3281,13 @@ void dump_program_tables (const struct program *p, int indent)
 
     fprintf(stderr,
 	    "%*s  %4d: %5x %6"PRINTPTRDIFFT"d %4d \"%s\"\n"
-	    "%*s        %s:%d\n",
+	    "%*s        %s:%ld\n",
 	    indent, "",
 	    d, id->identifier_flags, id->func.offset,
 	    id->run_time_type, id->name->str,
 	    indent, "",
-	    p->num_strings?p->strings[id->filename_strno]->str:"-", id->linenumber);
+	    p->num_strings?p->strings[id->filename_strno]->str:"-",
+	    (long)id->linenumber);
   }
 
   fprintf(stderr, "\n"
@@ -3339,7 +3342,8 @@ void dump_program_tables (const struct program *p, int indent)
 	  "%*sLinenumber table:\n",
 	  indent, "");
   {
-    INT32 off = 0, line = 0;
+    INT32 off = 0;
+    INT_TYPE line = 0;
     char *cnt = p->linenumbers;
 
     while (cnt < p->linenumbers + p->num_linenumbers) {
@@ -3360,7 +3364,7 @@ void dump_program_tables (const struct program *p, int indent)
       }
       off += get_small_number(&cnt);
       line += get_small_number(&cnt);
-      fprintf(stderr, "%*s    %8d:%8d\n", indent, "", off, line);
+      fprintf(stderr, "%*s    %8d:%8ld\n", indent, "", off, (long)line);
     }
   }
 
@@ -6740,6 +6744,10 @@ int program_index_no_free(struct svalue *to, struct svalue *what,
  *   Else if -32768 <= n < 32768:
  *     1. char		-127 (marker).
  *     2. short		The 16-bit signed number stored in big endian order.
+ *   Else if n < -0x80000000 or n > 0x7fffffff:
+ *     1. char		-127 (marker).
+ *     2. short		Zero (64-bit marker).
+ *     3. INT_TYPE	The 64-bit signed number stored in big endian order.
  *   Else:
  *     1. char		-128 (marker).
  *     2. int		The 32-bit signed number stored in big endian order.
@@ -6751,11 +6759,11 @@ int program_index_no_free(struct svalue *to, struct svalue *what,
  * definition line for a top level program is set to 0.
  */
 
-int get_small_number(char **q)
+INT_TYPE get_small_number(char **q)
 {
   /* This is a workaround for buggy cc & Tru64 */
   unsigned char *addr = (unsigned char *)*q;
-  int ret = *((signed char *)addr);
+  INT_TYPE ret = *((signed char *)addr);
   ret=*(signed char *)*q;
   addr++;
   switch(ret)
@@ -6763,6 +6771,17 @@ int get_small_number(char **q)
   case -127:
     ret = (((signed char *)addr)[0]<<8) | addr[1];
     addr += 2;
+    if (!ret) {
+      /* 64-bit signed number. */
+      ret = *((signed char *)addr++);
+      ret = (ret<<8) | *(addr++);
+      ret = (ret<<8) | *(addr++);
+      ret = (ret<<8) | *(addr++);
+      ret = (ret<<8) | *(addr++);
+      ret = (ret<<8) | *(addr++);
+      ret = (ret<<8) | *(addr++);
+      ret = (ret<<8) | *(addr++);
+    }
     break;
 
   case -128:
@@ -6790,10 +6809,10 @@ void start_line_numbering(void)
   Pike_compiler->last_pc=Pike_compiler->last_line=0;
 }
 
-static void insert_small_number(INT32 a)
+static void insert_small_number(INT_TYPE a)
 {
 #ifdef PIKE_DEBUG
-  int start = Pike_compiler->new_program->num_linenumbers;
+  size_t start = Pike_compiler->new_program->num_linenumbers;
 #endif /* PIKE_DEBUG */
   if(a>-127 && a<127)
   {
@@ -6802,6 +6821,22 @@ static void insert_small_number(INT32 a)
     add_to_linenumbers(-127);
     add_to_linenumbers(a>>8);
     add_to_linenumbers(a);
+#ifdef INT_TYPE_INT32_CONVERSION
+  } else if (a < -0x80000000L || a > 0x7fffffffL) {
+    /* Overload 16-bit zero as marker for 64-bit. */
+    fprintf(stderr, "Saving huge linenumber: %lld\n", (long long)a);
+    add_to_linenumbers(-127);
+    add_to_linenumbers(0);
+    add_to_linenumbers(0);
+    add_to_linenumbers(a>>56);
+    add_to_linenumbers(a>>48);
+    add_to_linenumbers(a>>40);
+    add_to_linenumbers(a>>32);
+    add_to_linenumbers(a>>24);
+    add_to_linenumbers(a>>16);
+    add_to_linenumbers(a>>8);
+    add_to_linenumbers(a);
+#endif
   }else{
     add_to_linenumbers(-128);
     add_to_linenumbers(a>>24);
@@ -6812,20 +6847,27 @@ static void insert_small_number(INT32 a)
 #ifdef PIKE_DEBUG
   {
     char *tmp = Pike_compiler->new_program->linenumbers + start;
-    INT32 res = get_small_number(&tmp);
+    INT_TYPE res = get_small_number(&tmp);
     if (a != res) {
       tmp = Pike_compiler->new_program->linenumbers + start;
       fprintf(stderr, "0x%p: %02x %02x %02x %02x %02x\n",
 	      tmp, (unsigned char) tmp[0], (unsigned char) tmp[1],
 	      (unsigned char) tmp[2], (unsigned char) tmp[3], (unsigned char) tmp[4]);
-      Pike_fatal("insert_small_number failed: %d (0x%08x) != %d (0x%08x)\n",
-	    a, a, res, res);
+      if ((start + 5) < Pike_compiler->new_program->num_linenumbers) {
+	/* 64-bit. Dump the remaining 6 bytes as well. */
+	fprintf(stderr, "0x%p: %02x %02x %02x %02x %02x %02x\n",
+		tmp, (unsigned char) tmp[5], (unsigned char) tmp[6],
+		(unsigned char) tmp[7], (unsigned char) tmp[8],
+		(unsigned char) tmp[9], (unsigned char) tmp[10]);
+      }
+      Pike_fatal("insert_small_number failed: %ld (0x%08lx) != %ld (0x%08lx)\n",
+		 (long)a, (long)a, (long)res, (long)res);
     }
   }
 #endif /* PIKE_DEBUG */
 }
 
-static void ext_insert_small_number (char **ptr, INT32 a)
+static void ext_insert_small_number (char **ptr, INT_TYPE a)
 {
   if(a>-127 && a<127)
   {
@@ -6834,6 +6876,21 @@ static void ext_insert_small_number (char **ptr, INT32 a)
     *(*ptr)++ = -127;
     *(*ptr)++ = a>>8;
     *(*ptr)++ = a;
+#ifdef INT_TYPE_INT32_CONVERSION
+  } else if (a < -0x80000000L || a > 0x7fffffffL) {
+    /* Overload 16-bit zero as marker for 64-bit. */
+    *(*ptr)++ = -127;
+    *(*ptr)++ = 0;
+    *(*ptr)++ = 0;
+    *(*ptr)++ = a>>56;
+    *(*ptr)++ = a>>48;
+    *(*ptr)++ = a>>40;
+    *(*ptr)++ = a>>32;
+    *(*ptr)++ = a>>24;
+    *(*ptr)++ = a>>16;
+    *(*ptr)++ = a>>8;
+    *(*ptr)++ = a;
+#endif
   }else{
     *(*ptr)++ = -128;
     *(*ptr)++ = a>>24;
@@ -6843,7 +6900,7 @@ static void ext_insert_small_number (char **ptr, INT32 a)
   }
 }
 
-void ext_store_program_line (struct program *prog, INT32 line, struct pike_string *file)
+void ext_store_program_line (struct program *prog, INT_TYPE line, struct pike_string *file)
 {
   char *ptr;
 
@@ -6854,35 +6911,36 @@ void ext_store_program_line (struct program *prog, INT32 line, struct pike_strin
     Pike_fatal ("Use store_linenumber instead when the program is compiled.\n");
 #endif
 
-  ptr = prog->linenumbers = xalloc (1 + 5 + 1 + (file->len << file->size_shift) + 5 + 5);
-  *ptr++ = 127;
-  ext_insert_small_number (&ptr, file->len);
-  *ptr++ = (char) file->size_shift;
-  MEMCPY (ptr, file->str, file->len << file->size_shift);
+  ptr = prog->linenumbers = xalloc (1 + 5 + 1 + (file->len << file->size_shift) + 1 + 11);
+  *ptr++ = 127;							/* 1 */
+  ext_insert_small_number (&ptr, file->len);			/* 5 */
+  *ptr++ = (char) file->size_shift;				/* 1 */
+  MEMCPY (ptr, file->str, file->len << file->size_shift);	/* - */
   ptr += file->len << file->size_shift;
-  *ptr++ = 0;			/* PC */
-  ext_insert_small_number (&ptr, line);
+  *ptr++ = 0;			/* PC */			/* 1 */
+  ext_insert_small_number (&ptr, line);				/* 11 */
   prog->num_linenumbers = ptr - prog->linenumbers;
 }
 
-void store_linenumber(INT32 current_line, struct pike_string *current_file)
+void store_linenumber(INT_TYPE current_line, struct pike_string *current_file)
 {
 /*  if(!store_linenumbers)  Pike_fatal("Fnord.\n"); */
 #ifdef PIKE_DEBUG
   if(a_flag)
   {
-    INT32 line=0, off=0;
+    INT_TYPE line=0;
+    INT32 off=0;
     size_t len = 0;
     INT32 shift = 0;
     char *file=0;
     char *cnt=Pike_compiler->new_program->linenumbers;
 
     if (a_flag > 50) {
-      fprintf(stderr, "store_linenumber(%d, \"%s\") at pc %d\n",
-	      current_line, current_file->str,
+      fprintf(stderr, "store_linenumber(%ld, \"%s\") at pc %d\n",
+	      (long)current_line, current_file->str,
 	      (INT32) PIKE_PC);
-      fprintf(stderr, "  last_line:%d last_file:\"%s\"\n",
-	      Pike_compiler->last_line,
+      fprintf(stderr, "  last_line:%ld last_file:\"%s\"\n",
+	      (long)Pike_compiler->last_line,
 	      Pike_compiler->last_file?Pike_compiler->last_file->str:"");
     }
 
@@ -6907,9 +6965,9 @@ void store_linenumber(INT32 current_line, struct pike_string *current_file)
       off+=get_small_number(&cnt);
       line+=get_small_number(&cnt);
       if (a_flag > 100) {
-	fprintf(stderr, "  off: %d, line: %d\n"
+	fprintf(stderr, "  off: %d, line: %ld\n"
 		"  raw: ",
-		off, line);
+		off, (long)line);
 	for (;start < cnt; start++) {
 	  fprintf(stderr, "%02x ", *((unsigned char *)start));
 	}
@@ -6923,12 +6981,12 @@ void store_linenumber(INT32 current_line, struct pike_string *current_file)
 	MEMCMP(Pike_compiler->last_file->str, file, len<<shift)))
     {
       Pike_fatal("Line numbering out of whack\n"
-	    "    (line : %d ?= %d)!\n"
+	    "    (line : %ld ?= %ld)!\n"
 	    "    (  pc : %d ?= %d)!\n"
 	    "    (shift: %d ?= %d)!\n"
 	    "    (len  : %"PRINTSIZET"d ?= %"PRINTSIZET"d)!\n"
 	    "    (file : %s ?= %s)!\n",
-	    Pike_compiler->last_line, line,
+		 (long)Pike_compiler->last_line, (long)line,
 	    Pike_compiler->last_pc, off,
 	    Pike_compiler->last_file?Pike_compiler->last_file->size_shift:0,
 	    shift,
@@ -6983,7 +7041,7 @@ void store_linenumber(INT32 current_line, struct pike_string *current_file)
   } while (0)
 
 PMOD_EXPORT struct pike_string *low_get_program_line (struct program *prog,
-						      INT32 *linep)
+						      INT_TYPE *linep)
 {
   *linep = 0;
 
@@ -7075,7 +7133,8 @@ static char *make_plain_file (char *file, size_t len, INT32 shift, int malloced)
  * can't be touched. It also converts wide strings to ordinary ones
  * with escaping.
  */
-PMOD_EXPORT char *low_get_program_line_plain(struct program *prog, INT32 *linep,
+PMOD_EXPORT char *low_get_program_line_plain(struct program *prog,
+					     INT_TYPE *linep,
 					     int malloced)
 {
   *linep = 0;
@@ -7095,7 +7154,7 @@ PMOD_EXPORT char *low_get_program_line_plain(struct program *prog, INT32 *linep,
  * class start is written to linep, or 0 if the program is the top
  * level of the file. */
 PMOD_EXPORT struct pike_string *get_program_line(struct program *prog,
-						 INT32 *linep)
+						 INT_TYPE *linep)
 {
   struct pike_string *res = low_get_program_line(prog, linep);
   if (!res) {
@@ -7107,7 +7166,8 @@ PMOD_EXPORT struct pike_string *get_program_line(struct program *prog,
 }
 
 PMOD_EXPORT struct pike_string *low_get_line (PIKE_OPCODE_T *pc,
-					      struct program *prog, INT32 *linep)
+					      struct program *prog,
+					      INT_TYPE *linep)
 {
   linep[0] = 0;
 
@@ -7116,7 +7176,8 @@ PMOD_EXPORT struct pike_string *low_get_line (PIKE_OPCODE_T *pc,
     if ((offset < (ptrdiff_t)prog->num_program) && (offset >= 0)) {
       static char *file = NULL;
       static char *base, *cnt;
-      static INT32 off,line,pid;
+      static INT32 off,pid;
+      static INT_TYPE line;
       static size_t len;
       static INT32 shift;
 
@@ -7168,7 +7229,7 @@ PMOD_EXPORT struct pike_string *low_get_line (PIKE_OPCODE_T *pc,
 /* This is to low_get_line as low_get_program_line_plain is to
  * low_get_program_line. */
 PMOD_EXPORT char *low_get_line_plain (PIKE_OPCODE_T *pc, struct program *prog,
-				      INT32 *linep, int malloced)
+				      INT_TYPE *linep, int malloced)
 {
   linep[0] = 0;
 
@@ -7177,7 +7238,8 @@ PMOD_EXPORT char *low_get_line_plain (PIKE_OPCODE_T *pc, struct program *prog,
 
     if ((offset < (ptrdiff_t)prog->num_program) && (offset >= 0)) {
       char *cnt = prog->linenumbers;
-      INT32 off = 0, line = 0;
+      INT32 off = 0;
+      INT_TYPE line = 0;
       char *file = NULL;
       size_t len = 0;
       INT32 shift = 0;
@@ -7211,16 +7273,16 @@ PMOD_EXPORT char *low_get_line_plain (PIKE_OPCODE_T *pc, struct program *prog,
 
 void gdb_program_line (struct program *prog)
 {
-  INT32 line;
+  INT_TYPE line;
   char *file = low_get_program_line_plain (prog, &line, 0);
-  fprintf (stderr, "%s:%d\n", file, line);
+  fprintf (stderr, "%s:%ld\n", file, (long)line);
 }
 
 void gdb_get_line (PIKE_OPCODE_T *pc, struct program *prog)
 {
-  INT32 line;
+  INT_TYPE line;
   char *file = low_get_line_plain (pc, prog, &line, 0);
-  fprintf (stderr, "%s:%d\n", file, line);
+  fprintf (stderr, "%s:%ld\n", file, (long)line);
 }
 
 #endif
@@ -7232,7 +7294,8 @@ void gdb_get_line (PIKE_OPCODE_T *pc, struct program *prog)
  * file.
  */
 PMOD_EXPORT struct pike_string *get_line(PIKE_OPCODE_T *pc,
-					 struct program *prog, INT32 *linep)
+					 struct program *prog,
+					 INT_TYPE *linep)
 {
   struct pike_string *res;
 
@@ -7253,7 +7316,8 @@ PMOD_EXPORT struct pike_string *get_line(PIKE_OPCODE_T *pc,
 }
 
 PMOD_EXPORT struct pike_string *low_get_function_line (struct object *o,
-						       int fun, INT32 *linep)
+						       int fun,
+						       INT_TYPE *linep)
 {
   if (o->prog) {
     struct program *p;
@@ -7292,7 +7356,8 @@ PMOD_EXPORT struct pike_string *low_get_function_line (struct object *o,
  *       add a reference to the returned string.
  */
 PMOD_EXPORT struct pike_string *get_identifier_line(struct program *p,
-						    int fun, INT32 *linep)
+						    int fun,
+						    INT_TYPE *linep)
 {
   struct reference *ref = PTR_FROM_INT(p, fun);
   struct identifier *id = ID_FROM_PTR(p, ref);
@@ -7317,7 +7382,7 @@ PMOD_EXPORT struct pike_string *get_identifier_line(struct program *p,
  *       by Pike-code, in which case it is a NO-OP.
  */
 PMOD_EXPORT void va_yyreport(int severity_level,
-			     struct pike_string *file, INT32 line,
+			     struct pike_string *file, INT_TYPE line,
 			     struct pike_string *system, INT32 args,
 			     const char *fmt, va_list vargs)
 {
@@ -7392,7 +7457,7 @@ PMOD_EXPORT void va_yyreport(int severity_level,
 }
 
 PMOD_EXPORT void low_yyreport(int severity_level,
-			      struct pike_string *file, INT32 line,
+			      struct pike_string *file, INT_TYPE line,
 			      struct pike_string *system,
 			      INT32 args, const char *fmt, ...)
 {
@@ -7449,9 +7514,9 @@ PMOD_EXPORT void yyerror(const char *str)
  * no got_file/got_line.
  */
 void yytype_report(int severity_level,
-		   struct pike_string *expected_file, INT32 expected_line, 
+		   struct pike_string *expected_file, INT_TYPE expected_line,
 		   struct pike_type *expected_t,
-		   struct pike_string *got_file, INT32 got_line,
+		   struct pike_string *got_file, INT_TYPE got_line,
 		   struct pike_type *got_t,
 		   INT32 args, const char *fmt, ...)
 {
@@ -7924,10 +7989,10 @@ static void f_reporter_report(INT32 args)
        * won't contain wide-strings... */
       if (level >= REPORT_ERROR) {
 	fprintf(stderr, "%s:%ld: %s\n",
-		filename->str, linenumber, message->str);
+		filename->str, (long)linenumber, message->str);
       } else {
 	fprintf(stderr, "%s:%ld: Warning: %s\n",
-		filename->str, linenumber, message->str);
+		filename->str, (long)linenumber, message->str);
       }
       fflush(stderr);
     }
@@ -9550,7 +9615,8 @@ static void low_enter_compiler(struct object *ce, int inherit)
   Pike_fp = new_frame;
 }
 
-PMOD_EXPORT void enter_compiler(struct pike_string *filename, int linenumber)
+PMOD_EXPORT void enter_compiler(struct pike_string *filename,
+				INT_TYPE linenumber)
 {
   struct object *ce = parent_clone_object(compilation_program,
 					  compilation_environment,
@@ -11159,8 +11225,8 @@ void yyexplain_not_compatible(int severity_level,
   int e;
   struct pike_string *s=findstring("__INIT");
   int res = 1;
-  INT32 a_line = 0;
-  INT32 b_line = 0;
+  INT_TYPE a_line = 0;
+  INT_TYPE b_line = 0;
   struct pike_string *a_file;
   struct pike_string *b_file;
   DECLARE_CYCLIC();
@@ -11201,8 +11267,8 @@ void yyexplain_not_compatible(int severity_level,
     if(((bid->run_time_type != PIKE_T_INT) ||
 	(ID_FROM_INT(a, i)->run_time_type != PIKE_T_INT)) &&
        !match_types(ID_FROM_INT(a,i)->type, bid->type)) {
-      INT32 aid_line = a_line;
-      INT32 bid_line = b_line;
+      INT_TYPE aid_line = a_line;
+      INT_TYPE bid_line = b_line;
       struct pike_string *aid_file = get_identifier_line(a, i, &aid_line);
       struct pike_string *bid_file = get_identifier_line(b, e, &bid_line);
       if (!aid_file) aid_file = a_file;
@@ -11228,8 +11294,8 @@ void yyexplain_not_implements(int severity_level,
 {
   int e;
   struct pike_string *s=findstring("__INIT");
-  INT32 a_line = 0;
-  INT32 b_line = 0;
+  INT_TYPE a_line = 0;
+  INT_TYPE b_line = 0;
   struct pike_string *a_file;
   struct pike_string *b_file;
   DECLARE_CYCLIC();
@@ -11253,7 +11319,7 @@ void yyexplain_not_implements(int severity_level,
     if(s == bid->name) continue;	/* Skip __INIT */
     i = find_shared_string_identifier(bid->name,a);
     if (i == -1) {
-      INT32 bid_line = b_line;
+      INT_TYPE bid_line = b_line;
       struct pike_string *bid_file;
       if (b->identifier_references[e].id_flags & (ID_OPTIONAL))
 	continue;		/* It's ok... */
@@ -11267,8 +11333,8 @@ void yyexplain_not_implements(int severity_level,
     }
 
     if (!pike_types_le(bid->type, ID_FROM_INT(a, i)->type)) {
-      INT32 aid_line = a_line;
-      INT32 bid_line = b_line;
+      INT_TYPE aid_line = a_line;
+      INT_TYPE bid_line = b_line;
       struct pike_string *aid_file = get_identifier_line(a, i, &aid_line);
       struct pike_string *bid_file = get_identifier_line(b, e, &bid_line);
       if (!aid_file) aid_file = a_file;
diff --git a/src/program.h b/src/program.h
index 8e62ad16efa26302eb42c209c3f337976e26774e..03173a986c851c48819f33f905183af5c0b0fa20 100644
--- a/src/program.h
+++ b/src/program.h
@@ -282,7 +282,7 @@ struct identifier
   struct pike_string *name;
   struct pike_type *type;
   unsigned INT32 filename_strno;	/* Index in strings. */
-  unsigned INT32 linenumber;
+  INT_TYPE linenumber;
   unsigned INT8 identifier_flags;	/* IDENTIFIER_??? */
   unsigned INT8 run_time_type;		/* PIKE_T_??? */
   unsigned INT16 opt_flags;		/* OPT_??? */
@@ -794,7 +794,7 @@ void optimize_program(struct program *p);
 void fsort_program_identifier_index(unsigned short *start,
 				    unsigned short *end,
 				    struct program *p);
-struct pike_string *find_program_name(struct program *p, INT32 *line);
+struct pike_string *find_program_name(struct program *p, INT_TYPE *line);
 int override_identifier (struct reference *ref, struct pike_string *name);
 void fixate_program(void);
 struct program *low_allocate_program(void);
@@ -803,7 +803,7 @@ void low_start_new_program(struct program *p,
 			   struct pike_string *name,
 			   int flags,
 			   int *idp);
-PMOD_EXPORT void debug_start_new_program(int line, const char *file);
+PMOD_EXPORT void debug_start_new_program(INT_TYPE line, const char *file);
 void dump_program_desc(struct program *p);
 int sizeof_variable(int run_time_type);
 void check_program(struct program *p);
@@ -929,32 +929,38 @@ int low_program_index_no_free(struct svalue *to, struct program *p, int e,
 			      struct object *parent, int parent_identifier);
 int program_index_no_free(struct svalue *to, struct svalue *what,
 			  struct svalue *ind);
-int get_small_number(char **q);
-void ext_store_program_line (struct program *prog, INT32 line, struct pike_string *file);
+INT_TYPE get_small_number(char **q);
+void ext_store_program_line (struct program *prog, INT_TYPE line,
+			     struct pike_string *file);
 void start_line_numbering(void);
-void store_linenumber(INT32 current_line, struct pike_string *current_file);
+void store_linenumber(INT_TYPE current_line, struct pike_string *current_file);
 PMOD_EXPORT struct pike_string *low_get_program_line(struct program *prog,
-						     INT32 *linep);
+						     INT_TYPE *linep);
 PMOD_EXPORT struct pike_string *get_program_line(struct program *prog,
-						 INT32 *linep);
-PMOD_EXPORT char *low_get_program_line_plain (struct program *prog, INT32 *linep,
+						 INT_TYPE *linep);
+PMOD_EXPORT char *low_get_program_line_plain (struct program *prog,
+					      INT_TYPE *linep,
 					      int malloced);
 PMOD_EXPORT struct pike_string *low_get_line(PIKE_OPCODE_T *pc,
-					     struct program *prog, INT32 *linep);
+					     struct program *prog,
+					     INT_TYPE *linep);
 PMOD_EXPORT char *low_get_line_plain (PIKE_OPCODE_T *pc, struct program *prog,
-				      INT32 *linep, int malloced);
+				      INT_TYPE *linep, int malloced);
 PMOD_EXPORT struct pike_string *get_line(PIKE_OPCODE_T *pc,
-					 struct program *prog, INT32 *linep);
+					 struct program *prog,
+					 INT_TYPE *linep);
 PMOD_EXPORT struct pike_string *low_get_function_line (struct object *o,
-						       int fun, INT32 *linep);
+						       int fun,
+						       INT_TYPE *linep);
 PMOD_EXPORT struct pike_string *get_identifier_line(struct program *p,
-						    int fun, INT32 *linep);
+						    int fun,
+						    INT_TYPE *linep);
 PMOD_EXPORT void va_yyreport(int severity_level,
-			     struct pike_string *file, INT32 line,
+			     struct pike_string *file, INT_TYPE line,
 			     struct pike_string *system, INT32 args,
 			     const char *fmt, va_list vargs);
 PMOD_EXPORT void low_yyreport(int severity_level,
-			      struct pike_string *file, INT32 line,
+			      struct pike_string *file, INT_TYPE line,
 			      struct pike_string *system,
 			      INT32 args, const char *fmt, ...);
 PMOD_EXPORT void yyreport(int severity_level, struct pike_string *system,
@@ -963,9 +969,9 @@ PMOD_EXPORT void yywarning(char *fmt, ...);
 PMOD_EXPORT void my_yyerror(const char *fmt,...);
 PMOD_EXPORT void yyerror(const char *s);
 void yytype_report(int severity_level,
-		   struct pike_string *expect_file, INT32 expect_line, 
+		   struct pike_string *expect_file, INT_TYPE expect_line,
 		   struct pike_type *expected_t,
-		   struct pike_string *got_file, INT32 got_line,
+		   struct pike_string *got_file, INT_TYPE got_line,
 		   struct pike_type *got_t,
 		   INT32 args, const char *fmt, ...);
 void yytype_error(const char *msg, struct pike_type *expected_t,
@@ -982,7 +988,8 @@ int call_dependants(struct Supporter *s, int finish);
 int report_compiler_dependency(struct program *p);
 struct compilation;
 void run_pass2(struct compilation *c);
-PMOD_EXPORT void enter_compiler(struct pike_string *filename, int linenumber);
+PMOD_EXPORT void enter_compiler(struct pike_string *filename,
+				INT_TYPE linenumber);
 PMOD_EXPORT void exit_compiler(void);
 struct program *compile(struct pike_string *aprog,
 			struct object *ahandler,
diff --git a/src/svalue.c b/src/svalue.c
index 92199c502adb4236422fd2e427589168b2a42e6c..d2a0f327c9097f12c9079e6c5b8c730ebb365d8e 100644
--- a/src/svalue.c
+++ b/src/svalue.c
@@ -1510,14 +1510,14 @@ PMOD_EXPORT void describe_svalue(const struct svalue *s,int indent,struct proces
 	  }
 	  else if (id && id->func.offset != -1) {
 	    char *file;
-	    INT32 line;
+	    INT_TYPE line;
 	    if ((file = low_get_line_plain (prog->program + id->func.offset,
 					    prog, &line, 1))) {
 	      my_strcat("function(");
 	      my_strcat(file);
 	      free(file);
 	      if (line) {
-		sprintf(buf, ":%d", line);
+		sprintf(buf, ":%ld", (long)line);
 		my_strcat(buf);
 	      }
 	      my_putchar(')');
@@ -1659,13 +1659,13 @@ PMOD_EXPORT void describe_svalue(const struct svalue *s,int indent,struct proces
 	}
 	else {
 	  char *file;
-	  INT32 line;
+	  INT_TYPE line;
 	  if ((file = low_get_program_line_plain (prog, &line, 1))) {
 	    my_strcat("object(");
 	    my_strcat(file);
 	    free(file);
 	    if (line) {
-	      sprintf(buf, ":%d", line);
+	      sprintf(buf, ":%ld", (long)line);
 	      my_strcat(buf);
 	    }
 	    my_putchar(')');
@@ -1733,13 +1733,13 @@ PMOD_EXPORT void describe_svalue(const struct svalue *s,int indent,struct proces
 
       {
 	char *file;
-	INT32 line;
+	INT_TYPE line;
 	if ((file = low_get_program_line_plain (prog, &line, 1))) {
 	  my_strcat("program(");
 	  my_strcat(file);
 	  free(file);
 	  if (line) {
-	    sprintf(buf, ":%d", line);
+	    sprintf(buf, ":%ld", (long)line);
 	    my_strcat(buf);
 	  }
 #if 0