Subject: specpdl change crashes Emacs (Solaris 10 sparc + Sun cc)
From: Paul Eggert <[email-masked]>
To: [email-masked]
Date: Mon, 17 Jun 2013 09:08:46 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

In trying out Emacs porting I found that the latest Emacs
trunk doesn't build on Solaris 10 32-bit sparc, Solaris 10,
compiled with Sun C 5.12 2011/11/16 (which is, I think,
the latest release available at no cost).

The problem was introduced some time between trunk bzr 112827
and 112838.  The intervening revisions don't compile.  I'm
pretty sure the problem was introduced in bzr 112828
(which merged the specpdl and backtrace stacks).

A brief look at the specpdl change did uncover one portability
(calculation of an address before the start of dynamically
allocated storage, which isn't portable), which I plan to fix,
but I expect the actual problem is somewhere else.

Here's a backtrace that I get while running temacs on trunk
bzr 112838 to create bootstrap-emacs.  I plan to take more of a
look at it more later, but am filing this bug report now to
document the problem.

I can't use GDB (it can't grok the Sun-generated executable),
and the bug apparently goes away if one disables optimizing.

current thread: t@1
=>[1] mark_object(arg = 2) (optimized), at 0x1cee9c (line ~5866) in "alloc.c"
  [2] mark_specpdl() (optimized), at 0x1f2340 (line ~3309) in "eval.c"
  [3] Fgarbage_collect() (optimized), at 0x1ce0fc (line ~5253) in "alloc.c"
  [4] maybe_gc() (optimized), at 0x1ebc24 (line ~3969) in "lisp.h"
  [5] Ffuncall(nargs = <value unavailable>, args = 0xffbfe850) (optimized), at 0x1f0aec (line ~2662) in "eval.c"
  [6] call1(fn = 5148554, arg1 = 7768262) (optimized), at 0x1f08a4 (line ~2510) in "eval.c"
  [7] readevalloop(readcharfun = 6194581, stream = (nil), sourcename = 6092777, printflag = 0, unibyte = <value unavailable>, readfun = 4978386, start = 4978386, end = 4978386) (optimized), at 0x21a950 (line ~1872) in "lread.c"
  [8] Feval_buffer(buffer = <value unavailable>, printflag = 4978386, filename = 6113281, unibyte = 4978386, do_allow_print = <value unavailable>) (optimized), at 0x21abcc (line ~1935) in "lread.c"
  [9] Ffuncall(nargs = <value unavailable>, args = <value unavailable>) (optimized), at 0x1f1004 (line ~2729) in "eval.c"
  [10] exec_byte_code(bytestr = <value unavailable>, vector = <value unavailable>, maxdepth = <value unavailable>, args_template = <value unavailable>, nargs = <value unavailable>, args = <value unavailable>) (optimized), at 0x234014 (line ~903) in "bytecode.c"
  [11] funcall_lambda(fun = 5442349, nargs = 4, arg_vector = 0xffbfeb90) (optimized), at 0x1f16f0 (line ~2948) in "eval.c"
  [12] Ffuncall(nargs = <value unavailable>, args = <value unavailable>) (optimized), at 0x1f10c8 (line ~2760) in "eval.c"
  [13] call4(fn = 5351986, arg1 = 6113281, arg2 = 6113281, arg3 = 4978386, arg4 = 4978386) (optimized), at 0x1f091c (line ~2559) in "eval.c"
  [14] Fload(file = 6113569, noerror = 0, nomessage = 4978386, nosuffix = <value unavailable>, must_suffix = <value unavailable>) (optimized), at 0x219410 (line ~1286) in "lread.c"
  [15] eval_sub(form = <value unavailable>) (optimized), at 0x1efde8 (line ~2097) in "eval.c"
  [16] internal_lisp_condition_case(var = 4978386, bodyform = 4995678, handlers = 5434966) (optimized), at 0x1edfa0 (line ~1169) in "eval.c"
  [17] Fcondition_case(args = 4995694) (optimized), at 0x1eddf4 (line ~1111) in "eval.c"
  [18] eval_sub(form = <value unavailable>) (optimized), at 0x1efb2c (line ~2029) in "eval.c"
  [19] readevalloop(readcharfun = 5065098, stream = 0x4b94b0, sourcename = 5153721, printflag = 0, unibyte = <value unavailable>, readfun = 4978386, start = 4978386, end = 4978386) (optimized), at 0x21a95c (line ~1873) in "lread.c"
  [20] Fload(file = 5071993, noerror = 1, nomessage = 4978386, nosuffix = <value unavailable>, must_suffix = <value unavailable>) (optimized), at 0x219810 (line ~1345) in "lread.c"
  [21] eval_sub(form = <value unavailable>) (optimized), at 0x1efde8 (line ~2097) in "eval.c"
  [22] Feval(form = 4992374, lexical = <value unavailable>) (optimized), at 0x1ef4b4 (line ~1918) in "eval.c"
  [23] top_level_2() (optimized), at 0x151dac (line ~1173) in "keyboard.c"
  [24] internal_condition_case(bfun = 0x151d9c = &`temacs`keyboard.c`top_level_2(), handlers = 5027634, hfun = 0x1519e8 = &`temacs`keyboard.c`cmd_error(Lisp_Object data)) (optimized), at 0x1ee104 (line ~1214) in "eval.c"
  [25] top_level_1(ignore = 4978386) (optimized), at 0x151dec (line ~1181) in "keyboard.c"
  [26] internal_catch(tag = 5025594, func = 0x151dbc = &`temacs`keyboard.c`top_level_1(register Lisp_Object ignore), arg = 4978386) (optimized), at 0x1edc14 (line ~988) in "eval.c"
  [27] command_loop() (optimized), at 0x151d08 (line ~1142) in "keyboard.c"
  [28] recursive_edit_1() (optimized), at 0x151564 (line ~776) in "keyboard.c"
  [29] Frecursive_edit() (optimized), at 0x151708 (line ~840) in "keyboard.c"
  [30] main(argc = <value unavailable>, argv = <value unavailable>) (optimized), at 0x14dcf8 (line ~1539) in "emacs.c"
(dbx)