all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#8623: 23.3.50; (woman "git-remote") crashes
@ 2011-05-05 20:09 Sven Joachim
  2011-05-05 20:44 ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Sven Joachim @ 2011-05-05 20:09 UTC (permalink / raw)
  To: 8623; +Cc: Sven Joachim

> Please describe exactly what actions triggered the bug
> and the precise symptoms of the bug.

I did M-x woman RET git-remote RET and Emacs segfaulted.

> If you can, give a recipe starting from `emacs -Q':

The above problem is reproducible in `emacs -Q'.

> If Emacs crashed, and you have the Emacs process in the gdb debugger,
> please include the output from the following gdb commands:
>     `bt full' and `xbacktrace'.

Program received signal SIGSEGV, Segmentation fault.
0x0815e65e in scan_for_column (endpos=0xffffc0dc, goalcol=0xffffc0d8, prevcol=0x0) at indent.c:649
(gdb) bt full
#0  0x0815e65e in scan_for_column (endpos=0xffffc0dc, goalcol=0xffffc0d8, prevcol=0x0) at indent.c:649
        entry = 524294
        i = <value optimized out>
        n = 1074790530
        c = <value optimized out>
        tab_width = 5
        ctl_arrow = 1
        dp = 0x874d338
        multibyte = 1
        cmp_it = {
          stop_pos = 6189, 
          id = -1, 
          ch = -2, 
          lookback = 0, 
          nglyphs = 0, 
          nchars = 0, 
          nbytes = 0, 
          from = 0, 
          to = 0, 
          width = 0
        }
        window = <value optimized out>
        w = 0x8717e58
        col = 1334
        prev_col = 6
        goal = 536870911
        end = <value optimized out>
        scan = 6131
        scan_byte = 6131
        next_boundary = 6189
#1  0x0815f36e in current_column_1 () at indent.c:731
        col = 536870911
        opoint = 6189
#2  current_column () at indent.c:362
        col = <value optimized out>
        ptr = <value optimized out>
        stop = <value optimized out>
        tab_seen = <value optimized out>
        post_tab = <value optimized out>
        c = <value optimized out>
        tab_width = 5
        ctl_arrow = 1
        dp = 0x874d338
#3  0x081c7747 in Fbyte_code (bytestr=<value optimized out>, vector=141928285, maxdepth=16) at bytecode.c:1317
        count = 42
        op = 105
        vectorp = 0x875a760
        stack = {
          pc = 0x88e18f1 "\016\030V)\203\273", 
          top = 0xffffc10c, 
          bottom = 0xffffc110, 
          byte_string = 141722145, 
          byte_string_start = 0x88e1868 "\b\203\006", 
          constants = 141928285, 
          next = 0xffffc2d4
        }
        top = 0xffffc10c
        result = <value optimized out>
#4  0x08190128 in funcall_lambda (fun=143061829, nargs=2, arg_vector=0xffffc284) at eval.c:3220
        val = <value optimized out>
        syms_left = 138529034
        next = <value optimized out>
        count = 40
        i = <value optimized out>
        optional = <value optimized out>
        rest = <value optimized out>
#5  0x08190443 in Ffuncall (nargs=3, args=0xffffc280) at eval.c:3088
        fun = <value optimized out>
        original_fun = 140836434
        funcar = <value optimized out>
        numargs = 2
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffc3ac, 
          function = 0xffffc280, 
          args = 0xffffc284, 
          nargs = 2, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = <value optimized out>
        i = <value optimized out>
#6  0x081c7f8a in Fbyte_code (bytestr=<value optimized out>, vector=141725429, maxdepth=12) at bytecode.c:680
        count = 40
        op = 2
        vectorp = 0x8728ef8
        stack = {
          pc = 0x88e1c7f "\207", 
          top = 0xffffc288, 
          bottom = 0xffffc280, 
          byte_string = 141724625, 
          byte_string_start = 0x88e1c6c "\b\tB\021\n\vB\023\b\306 \\\020\f\022\307\r\b\"\207", 
          constants = 141725429, 
          next = 0xffffc464
        }
        top = 0xffffc280
        result = <value optimized out>
#7  0x08190128 in funcall_lambda (fun=141725573, nargs=1, arg_vector=0xffffc3f4) at eval.c:3220
        val = <value optimized out>
        syms_left = 138529034
        next = <value optimized out>
        count = 39
        i = <value optimized out>
        optional = <value optimized out>
        rest = <value optimized out>
#8  0x08190443 in Ffuncall (nargs=2, args=0xffffc3f0) at eval.c:3088
        fun = <value optimized out>
        original_fun = 143113522
        funcar = <value optimized out>
        numargs = 1
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffc53c, 
          function = 0xffffc3f0, 
          args = 0xffffc3f4, 
          nargs = 1, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = <value optimized out>
        i = <value optimized out>
#9  0x081c7f8a in Fbyte_code (bytestr=<value optimized out>, vector=141708333, maxdepth=44) at bytecode.c:680
        count = 28
        op = 1
        vectorp = 0x8724c30
        stack = {
          pc = 0x88e0f89 "\210\202\061", 
          top = 0xffffc3f4, 
          bottom = 0xffffc3f0, 
          byte_string = 143819513, 
          byte_string_start = 0x88e0ef4 "\306\307 \310K\311K\305K\bʉ\211\211\031\032\033\034\030\035\036\t\036\b\036\037\036 \313\016\037\306\"\210\310\314M\210\311\315KM\210\305\314M\210Ύ\317\016!\312\306#\205\231", 
          constants = 141708333, 
          next = 0xffffc5e4
        }
        top = 0xffffc3f0
        result = <value optimized out>
#10 0x08190128 in funcall_lambda (fun=141955869, nargs=0, arg_vector=0xffffc584) at eval.c:3220
        val = <value optimized out>
        syms_left = 138529034
        next = <value optimized out>
        count = 28
        i = <value optimized out>
        optional = <value optimized out>
        rest = <value optimized out>
#11 0x08190443 in Ffuncall (nargs=1, args=0xffffc580) at eval.c:3088
        fun = <value optimized out>
        original_fun = 141707386
        funcar = <value optimized out>
        numargs = 0
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffc6bc, 
          function = 0xffffc580, 
          args = 0xffffc584, 
          nargs = 0, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = <value optimized out>
        i = <value optimized out>
#12 0x081c7f8a in Fbyte_code (bytestr=<value optimized out>, vector=142967797, maxdepth=24) at bytecode.c:680
        count = 24
        op = 0
        vectorp = 0x88583f8
        stack = {
          pc = 0x88e47f0 "\210\n\203\272\001\302\016Q!\210\016\\\203\357\001\016Qb\210\374\016]\306\330#\203\326\001\375\376!\210\377c\210\202\303\001\016Qb\210\374\016W\306\330#\203\357\001\375\376!\210\201^", 
          top = 0xffffc580, 
          bottom = 0xffffc580, 
          byte_string = 141925241, 
          byte_string_start = 0x88e4640 "\306\b\t\306\032\031\030\033\f\025\f\026@\307\026AƉ\026B\026C\306\026D\016E\211\026F\016G8\026H\306\026I\310\311\016J!!\312B\026K\313 \210\016L\203M", 
          constants = 142967797, 
          next = 0xffffc754
        }
        top = 0xffffc580
        result = <value optimized out>
#13 0x08190128 in funcall_lambda (fun=141659621, nargs=2, arg_vector=0xffffc704) at eval.c:3220
        val = <value optimized out>
        syms_left = 138529034
        next = <value optimized out>
        count = 22
        i = <value optimized out>
        optional = <value optimized out>
        rest = <value optimized out>
#14 0x08190443 in Ffuncall (nargs=3, args=0xffffc700) at eval.c:3088
        fun = <value optimized out>
        original_fun = 141707026
        funcar = <value optimized out>
        numargs = 2
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffc82c, 
          function = 0xffffc700, 
          args = 0xffffc704, 
          nargs = 2, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = <value optimized out>
        i = <value optimized out>
#15 0x081c7f8a in Fbyte_code (bytestr=<value optimized out>, vector=141882477, maxdepth=16) at bytecode.c:680
        count = 20
        op = 2
        vectorp = 0x874f470
        stack = {
          pc = 0x88e433e "\210\311 \211\021@\n@Z\316_\t\211\033A@)\n\211\033A@)Z\\\021\313\317\t\"\210\320\t!\210*\305\321!\207", 
          top = 0xffffc708, 
          bottom = 0xffffc700, 
          byte_string = 143121441, 
          byte_string_start = 0x88e431c "\304 \210\305\306!\210\307\300!\203\025", 
          constants = 141882477, 
          next = 0xffffc8c4
        }
        top = 0xffffc700
        result = <value optimized out>
#16 0x08190128 in funcall_lambda (fun=141882669, nargs=0, arg_vector=0xffffc874) at eval.c:3220
        val = <value optimized out>
        syms_left = 138529034
        next = <value optimized out>
        count = 20
        i = <value optimized out>
        optional = <value optimized out>
        rest = <value optimized out>
#17 0x08190443 in Ffuncall (nargs=1, args=0xffffc870) at eval.c:3088
        fun = <value optimized out>
        original_fun = 141390506
        funcar = <value optimized out>
        numargs = 0
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffc99c, 
          function = 0xffffc870, 
          args = 0xffffc874, 
          nargs = 0, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = <value optimized out>
        i = <value optimized out>
#18 0x081c7f8a in Fbyte_code (bytestr=<value optimized out>, vector=140904077, maxdepth=16) at bytecode.c:680
        count = 20
        op = 0
        vectorp = 0x8660690
        stack = {
          pc = 0x88e9839 "\210\202\030", 
          top = 0xffffc870, 
          bottom = 0xffffc870, 
          byte_string = 141622201, 
          byte_string_start = 0x88e982c "eb\210\300\301\302\303#\203\021", 
          constants = 140904077, 
          next = 0xffffca34
        }
        top = 0xffffc870
        result = <value optimized out>
#19 0x08190128 in funcall_lambda (fun=143556773, nargs=0, arg_vector=0xffffc9e4) at eval.c:3220
        val = <value optimized out>
        syms_left = 138529034
        next = <value optimized out>
        count = 20
        i = <value optimized out>
        optional = <value optimized out>
        rest = <value optimized out>
#20 0x08190443 in Ffuncall (nargs=1, args=0xffffc9e0) at eval.c:3088
        fun = <value optimized out>
        original_fun = 141390218
        funcar = <value optimized out>
        numargs = 0
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffcb0c, 
          function = 0xffffc9e0, 
          args = 0xffffc9e4, 
          nargs = 0, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = <value optimized out>
        i = <value optimized out>
#21 0x081c7f8a in Fbyte_code (bytestr=<value optimized out>, vector=143025109, maxdepth=12) at bytecode.c:680
        count = 19
        op = 0
        vectorp = 0x88663d8
        stack = {
          pc = 0x88e97ed ")\207", 
          top = 0xffffc9e0, 
          bottom = 0xffffc9e0, 
          byte_string = 141622841, 
          byte_string_start = 0x88e97ac "\b\031\n\203\027", 
          constants = 143025109, 
          next = 0xffffcbb4
        }
        top = 0xffffc9e0
        result = <value optimized out>
#22 0x08190128 in funcall_lambda (fun=143524677, nargs=3, arg_vector=0xffffcb54) at eval.c:3220
        val = <value optimized out>
        syms_left = 138529034
        next = <value optimized out>
        count = 16
        i = <value optimized out>
        optional = <value optimized out>
        rest = <value optimized out>
#23 0x08190443 in Ffuncall (nargs=4, args=0xffffcb50) at eval.c:3088
        fun = <value optimized out>
        original_fun = 141390410
        funcar = <value optimized out>
        numargs = 3
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffcc8c, 
          function = 0xffffcb50, 
          args = 0xffffcb54, 
          nargs = 3, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = <value optimized out>
        i = <value optimized out>
#24 0x081c7f8a in Fbyte_code (bytestr=<value optimized out>, vector=141623797, maxdepth=24) at bytecode.c:680
        count = 11
        op = 3
        vectorp = 0x87101f8
        stack = {
          pc = 0x88e95f7 "\210\v\204q", 
          top = 0xffffcb5c, 
          bottom = 0xffffcb50, 
          byte_string = 141574081, 
          byte_string_start = 0x88e9594 "\306\b!\211\020\021\n\307\033\034\310\025\f\203!", 
          constants = 141623797, 
          next = 0xffffcd24
        }
        top = 0xffffcb50
        result = <value optimized out>
#25 0x08190128 in funcall_lambda (fun=143417717, nargs=1, arg_vector=0xffffccd4) at eval.c:3220
        val = <value optimized out>
        syms_left = 138529034
        next = <value optimized out>
        count = 9
        i = <value optimized out>
        optional = <value optimized out>
        rest = <value optimized out>
#26 0x08190443 in Ffuncall (nargs=2, args=0xffffccd0) at eval.c:3088
        fun = <value optimized out>
        original_fun = 139572354
        funcar = <value optimized out>
        numargs = 1
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffcdfc, 
          function = 0xffffccd0, 
          args = 0xffffccd4, 
          nargs = 1, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = <value optimized out>
        i = <value optimized out>
#27 0x081c7f8a in Fbyte_code (bytestr=<value optimized out>, vector=140539357, maxdepth=16) at bytecode.c:680
        count = 8
        op = 1
        vectorp = 0x86075e0
        stack = {
          pc = 0x8870e28 "\202!", 
          top = 0xffffccd4, 
          bottom = 0xffffccd0, 
          byte_string = 141530153, 
          byte_string_start = 0x8870e10 "\b;\203\f", 
          constants = 140539357, 
          next = 0x0
        }
        top = 0xffffccd0
        result = <value optimized out>
#28 0x08190128 in funcall_lambda (fun=143111053, nargs=2, arg_vector=0xffffce44) at eval.c:3220
        val = <value optimized out>
        syms_left = 138529034
        next = <value optimized out>
        count = 6
        i = <value optimized out>
        optional = <value optimized out>
        rest = <value optimized out>
#29 0x08190443 in Ffuncall (nargs=3, args=0xffffce40) at eval.c:3088
        fun = <value optimized out>
        original_fun = 139572306
        funcar = <value optimized out>
        numargs = 2
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffd02c, 
          function = 0xffffce40, 
          args = 0xffffce44, 
          nargs = 2, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = <value optimized out>
        i = <value optimized out>
#30 0x0818f51d in Fapply (nargs=2, args=0xffffceb8) at eval.c:2506
        i = <value optimized out>
        numargs = 2
        spread_arg = 138529034
        funcall_args = 0xffffce40
        fun = <value optimized out>
        retval = <value optimized out>
        gcpro1 = {
          next = <value optimized out>, 
          var = <value optimized out>, 
          nvars = 3
        }
        sa_count = 6
        sa_must_free = 0
#31 0x0818f73f in apply1 (fn=139572306, arg=141160638) at eval.c:2780
        args = {139572306, 141160638}
#32 0x0818c7be in Fcall_interactively (function=139572306, record_flag=138529082, keys=138563309) at callint.c:396
        input = <value optimized out>
        args = <value optimized out>
        visargs = <value optimized out>
        specs = 141160638
        filter_specs = <value optimized out>
        teml = <value optimized out>
        up_event = 138529034
        enable = 138529034
        speccount = <value optimized out>
        next_event = <value optimized out>
        prefix_arg = 138529034
        string = 0x0
        tem = <value optimized out>
        varies = <value optimized out>
        i = <value optimized out>
        j = <value optimized out>
        count = <value optimized out>
        foo = <value optimized out>
        prompt1 = "aK\026\b\256&S\bY\372\300Mb\364\224\026\216\030\016\000\000\000\000\000\a\b\000\000\000\000\000\000\002\000\000\000 S\016\000\244\201\000\000\001\000\000\000\256&S\b\n\311A\bP\000\000\000\n\311A\b\270N\026\b\256&S\b:\311A\b\000\020\000\000X\001\000\000\n\311A\b\n\311A\bP\000\000\000\204\361\030\b"
        tem1 = <value optimized out>
        arg_from_tty = 0
        key_count = 7
        record_then_fail = 0
        save_this_command = 139572306
        save_last_command = 138559994
        save_this_original_command = 139471866
        save_real_this_command = 139572306
#33 0x08190607 in Ffuncall (nargs=4, args=0xffffd070) at eval.c:3037
        fun = <value optimized out>
        original_fun = <value optimized out>
        funcar = <value optimized out>
        numargs = 3
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffd16c, 
          function = 0xffffd070, 
          args = 0xffffd074, 
          nargs = 3, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = 0xffffd074
        i = <value optimized out>
#34 0x081908a7 in call3 (fn=138649522, arg1=139572306, arg2=138529082, arg3=138529034) at eval.c:2857
        ret_ungc_val = 1334
        args = {138649522, 139572306, 138529082, 138529034}
#35 0x081218fa in Fexecute_extended_command (prefixarg=138529034) at keyboard.c:10675
        function = 139572306
        buf = "M-x ", '\000' <repeats 32 times>, "\b.B\b"
        saved_last_point_position = 192
        saved_keys = <value optimized out>
        saved_last_point_position_buffer = 138554893
        bindings = 138529034
        value = <value optimized out>
        hstarted = 141520048
#36 0x0819062e in Ffuncall (nargs=2, args=0xffffd200) at eval.c:3031
        fun = <value optimized out>
        original_fun = <value optimized out>
        funcar = <value optimized out>
        numargs = 1
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0xffffd37c, 
          function = 0xffffd200, 
          args = 0xffffd204, 
          nargs = 1, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = 0xffffd204
        i = <value optimized out>
#37 0x0818ceb0 in Fcall_interactively (function=138564306, record_flag=138529034, keys=138563309) at callint.c:869
        val = <value optimized out>
        args = 0xffffd200
        visargs = 0xffffd1e0
        specs = <value optimized out>
        filter_specs = <value optimized out>
        teml = <value optimized out>
        up_event = 138529034
        enable = 0
        speccount = <value optimized out>
        next_event = <value optimized out>
        prefix_arg = 138529034
        string = 0xffffd220 "P"
        tem = <value optimized out>
        varies = 0xffffd1c0
        i = <value optimized out>
        j = 1
        count = 1
        foo = <value optimized out>
        prompt1 = '\000' <repeats 99 times>
        tem1 = <value optimized out>
        arg_from_tty = <value optimized out>
        key_count = 1
        record_then_fail = 0
        save_this_command = 138564306
        save_last_command = 138529034
        save_this_original_command = 138564306
        save_real_this_command = 138564306
#38 0x08190607 in Ffuncall (nargs=4, args=0xffffd3c0) at eval.c:3037
        fun = <value optimized out>
        original_fun = <value optimized out>
        funcar = <value optimized out>
        numargs = 3
        lisp_numargs = <value optimized out>
        val = <value optimized out>
        backtrace = {
          next = 0x0, 
          function = 0xffffd3c0, 
          args = 0xffffd3c4, 
          nargs = 3, 
          evalargs = 0 '\000', 
          debug_on_exit = 0 '\000'
        }
        internal_args = 0xffffd3c4
        i = <value optimized out>
#39 0x081908a7 in call3 (fn=138649522, arg1=138564306, arg2=138529034, arg3=138529034) at eval.c:2857
        ret_ungc_val = 1334
        args = {138649522, 138564306, 138529034, 138529034}
#40 0x0812ea21 in command_loop_1 () at keyboard.c:1906
        scount = 2
        cmd = <value optimized out>
        lose = <value optimized out>
        keybuf = {536871392, -134230028, -149407324, 38, -11084, -134307535, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -11160, -11360, 0, 0, 138791090, 138529034, -1472036457, 0, 64, 139301496, 139301496, 139301512, -9704, 135405824}
        i = <value optimized out>
        prev_modiff = 10
        prev_buffer = 0x8422e08
        already_adjusted = 0
#41 0x0818ed2a in internal_condition_case (bfun=0x812e6d0 <command_loop_1>, handlers=138567018, hfun=0x8123820 <cmd_error>) at eval.c:1492
        val = <value optimized out>
        c = {
          tag = 138529034, 
          val = 138529034, 
          next = 0xffffd5e8, 
          gcpro = 0x0, 
          jmp = {{
              __jmpbuf = {139301496, 139301496, 139301512, -9704, 604656024, -361065353}, 
              __mask_was_saved = 0, 
              __saved_mask = {
                __val = {0, 0, 0, 0, 0, 4294956448, 4294956376, 4294956388, 0, 4160739592, 0, 0, 0, 134547621, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4294956688, 4294956400, 4294956688, 4145581780, 4147160480, 2, 4294967295, 4160737268, 134547621}
              }
            }}, 
          backlist = 0x0, 
          handlerlist = 0x0, 
          lisp_eval_depth = 0, 
          pdlcount = 2, 
          poll_suppress_count = 1, 
          interrupt_input_blocked = 0, 
          byte_stack = 0x0
        }
        h = {
          handler = 138567018, 
          var = 138529034, 
          chosen_clause = 134533396, 
          tag = 0xffffd4c4, 
          next = 0x0
        }
#42 0x08122545 in command_loop_2 () at keyboard.c:1362
        val = 1334
#43 0x0818ec39 in internal_catch (tag=138564090, func=0x8122520 <command_loop_2>, arg=138529034) at eval.c:1228
        c = {
          tag = 138564090, 
          val = 138529034, 
          next = 0x0, 
          gcpro = 0x0, 
          jmp = {{
              __jmpbuf = {139301496, 139301496, 139301512, -9704, 604541336, -361026441}, 
              __mask_was_saved = 0, 
              __saved_mask = {
                __val = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138554888, 138529034, 138696570, 138694331, 135786269, 138696570, 138694331, 138529034, 138554888, 0, 4146955264, 0, 14, 140779584, 138694328, 138529058, 4294925999, 400, 4294958136, 136349331, 138696570, 138529034}
              }
            }}, 
          backlist = 0x0, 
          handlerlist = 0x0, 
          lisp_eval_depth = 0, 
          pdlcount = 2, 
          poll_suppress_count = 1, 
          interrupt_input_blocked = 0, 
          byte_stack = 0x0
        }
#44 0x08123a1f in command_loop () at keyboard.c:1341
No locals.
#45 0x08123aba in recursive_edit_1 () at keyboard.c:956
        count = 1
        val = <value optimized out>
#46 0x08123bee in Frecursive_edit () at keyboard.c:1018
        count = <value optimized out>
        buffer = 138529034
#47 0x08057727 in main (argc=<value optimized out>, argv=0xffffdad4) at emacs.c:1833
        dummy = -9600
        stack_bottom_variable = 8 '\b'
        do_initial_setlocale = <value optimized out>
        skip_args = 0
        rlim = {
          rlim_cur = 8388608, 
          rlim_max = 18446744073709551615
        }
        no_loadup = 0
        junk = 0x0
        dname_arg = 0x0

Lisp Backtrace:
"woman2-format-paragraphs" (0xffffc284)
"woman2-RS" (0xffffc3f4)
"woman2-roff-buffer" (0xffffc584)
"woman-decode-region" (0xffffc704)
"woman-decode-buffer" (0xffffc874)
"woman-process-buffer" (0xffffc9e4)
"woman-really-find-file" (0xffffcb54)
"woman-find-file" (0xffffccd4)
"woman" (0xffffce44)
"call-interactively" (0xffffd074)
"execute-extended-command" (0xffffd204)
"call-interactively" (0xffffd3c4)
(gdb) xbacktrace 
"woman2-format-paragraphs" (0xffffc284)
"woman2-RS" (0xffffc3f4)
"woman2-roff-buffer" (0xffffc584)
"woman-decode-region" (0xffffc704)
"woman-decode-buffer" (0xffffc874)
"woman-process-buffer" (0xffffc9e4)
"woman-really-find-file" (0xffffcb54)
"woman-find-file" (0xffffccd4)
"woman" (0xffffce44)
"call-interactively" (0xffffd074)
"execute-extended-command" (0xffffd204)
"call-interactively" (0xffffd3c4)


In GNU Emacs 23.3.50.1 (i486-pc-linux-gnu, GTK+ Version 2.24.4)
 of 2011-05-04 on turtle
Windowing system distributor `The X.Org Foundation', version 11.0.11001000
configured using `configure  '--build=i486-pc-linux-gnu' '--without-gconf' 'build_alias=i486-pc-linux-gnu''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: C
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r e p o r t - e m <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Load-path shadows:
None found.

Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
easymenu mml-sec password-cache mm-decode mm-bodies mm-encode mailcap
mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader
gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit
mailheader canlock sha1 hex-util hashcash mail-utils emacsbug tooltip
ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting
tool-bar dnd fontset image fringe lisp-mode register page menu-bar
rfn-eshadow timer select scroll-bar mldrag mouse jit-lock font-lock
syntax facemenu font-core frame cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind font-render-setting gtk
x-toolkit x multi-tty emacs)





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-05 20:09 bug#8623: 23.3.50; (woman "git-remote") crashes Sven Joachim
@ 2011-05-05 20:44 ` Eli Zaretskii
  2011-05-05 21:12   ` Sven Joachim
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2011-05-05 20:44 UTC (permalink / raw)
  To: Sven Joachim; +Cc: 8623

> From: Sven Joachim <svenjoac@gmx.de>
> Date: Thu, 05 May 2011 22:09:37 +0200
> Cc: Sven Joachim <svenjoac@gmx.de>
> 
> > Please describe exactly what actions triggered the bug
> > and the precise symptoms of the bug.
> 
> I did M-x woman RET git-remote RET and Emacs segfaulted.

Does this happen for you in "emacs -nw -Q"?

Also, can you build Emacs without optimizations, and try reproducing
in the unoptimized binary?  If you succeed, please show the backtrace
from there, and also manually load woman.el (the source) before typing
"M-x woman", to make the Lisp backtrace more accurate.  TIA

FWIW, I couldn't reproduce this on x86_64 GNU/Linux system, on a
text-mode terminal.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-05 20:44 ` Eli Zaretskii
@ 2011-05-05 21:12   ` Sven Joachim
  2011-05-06 10:15     ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Sven Joachim @ 2011-05-05 21:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 8623

On 2011-05-05 22:44 +0200, Eli Zaretskii wrote:

>> From: Sven Joachim <svenjoac@gmx.de>
>> Date: Thu, 05 May 2011 22:09:37 +0200
>> Cc: Sven Joachim <svenjoac@gmx.de>
>> 
>> > Please describe exactly what actions triggered the bug
>> > and the precise symptoms of the bug.
>> 
>> I did M-x woman RET git-remote RET and Emacs segfaulted.
>
> Does this happen for you in "emacs -nw -Q"?

No, only in a graphical session.  Also, it only seems to happen when
building with GCC 4.6, which explains why I did not see the problem
until recently when Debian switched to GCC 4.6 as the default compiler:

$ gcc --version | head -n1
gcc (Debian 4.6.0-6) 4.6.1 20110428 (prerelease)

> Also, can you build Emacs without optimizations, and try reproducing
> in the unoptimized binary?

Alas, the unoptimized binary does not crash.

> If you succeed, please show the backtrace
> from there, and also manually load woman.el (the source) before typing
> "M-x woman", to make the Lisp backtrace more accurate.

Here is the Lisp backtrace with the uncompiled woman.el loaded:

(gdb) xbacktrace 
"current-column" (0xffffac44)
">" (0xffffad1c)
"save-excursion" (0xffffadfc)
"or" (0xffffaebc)
"if" (0xffffaf7c)
"when" (0xffffb01c)
"let" (0xffffb13c)
"while" (0xffffb21c)
"if" (0xffffb2dc)
"if" (0xffffb39c)
"unless" (0xffffb43c)
"woman2-format-paragraphs" (0xffffb4e0)
"woman2-RS" (0xffffb6f4)
"funcall" (0xffffb6f0)
"if" (0xffffb82c)
"while" (0xffffb90c)
"unwind-protect" (0xffffb9cc)
"let" (0xffffbb0c)
"woman2-roff-buffer" (0xffffbbb0)
"let" (0xffffbd9c)
"woman-decode-region" (0xffffbe40)
"let" (0xffffc03c)
"woman-decode-buffer" (0xffffc0e0)
"if" (0xffffc24c)
"woman-process-buffer" (0xffffc2f0)
"let" (0xffffc4dc)
"woman-really-find-file" (0xffffc580)
"let*" (0xffffc75c)
"or" (0xffffc81c)
"let" (0xffffc93c)
"woman-find-file" (0xffffc9e0)
"if" (0xffffcb5c)
"let" (0xffffcc7c)
"if" (0xffffcd1c)
"woman" (0xffffce44)
"call-interactively" (0xffffd074)
"execute-extended-command" (0xffffd204)
"call-interactively" (0xffffd3c4)
(gdb)

Regards,
        Sven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-05 21:12   ` Sven Joachim
@ 2011-05-06 10:15     ` Eli Zaretskii
  2011-05-06 10:50       ` Sven Joachim
  2011-05-06 14:37       ` Paul Eggert
  0 siblings, 2 replies; 20+ messages in thread
From: Eli Zaretskii @ 2011-05-06 10:15 UTC (permalink / raw)
  To: Sven Joachim, Paul Eggert; +Cc: 8623

> From: Sven Joachim <svenjoac@gmx.de>
> Cc: 8623@debbugs.gnu.org
> Date: Thu, 05 May 2011 23:12:18 +0200
> 
> $ gcc --version | head -n1
> gcc (Debian 4.6.0-6) 4.6.1 20110428 (prerelease)
> 
> > Also, can you build Emacs without optimizations, and try reproducing
> > in the unoptimized binary?
> 
> Alas, the unoptimized binary does not crash.

Darn!  Debugging optimized code is pretty much hopeless with current
versions of GCC.

Paul, could you please take a look at this?  Could this be due to the
same problems with GCC 4.6 optimizations you recently fixed on the
trunk?  If so, we may need similar changes on the release branch.

Sven, could you also try with the trunk build?





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-06 10:15     ` Eli Zaretskii
@ 2011-05-06 10:50       ` Sven Joachim
  2011-05-06 12:36         ` Sven Joachim
  2011-05-06 14:37       ` Paul Eggert
  1 sibling, 1 reply; 20+ messages in thread
From: Sven Joachim @ 2011-05-06 10:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Paul Eggert, 8623

On 2011-05-06 12:15 +0200, Eli Zaretskii wrote:

>> From: Sven Joachim <svenjoac@gmx.de>
>> Cc: 8623@debbugs.gnu.org
>> Date: Thu, 05 May 2011 23:12:18 +0200
>> 
>> $ gcc --version | head -n1
>> gcc (Debian 4.6.0-6) 4.6.1 20110428 (prerelease)
>> 
>> > Also, can you build Emacs without optimizations, and try reproducing
>> > in the unoptimized binary?
>> 
>> Alas, the unoptimized binary does not crash.
>
> Darn!  Debugging optimized code is pretty much hopeless with current
> versions of GCC.
>
> Paul, could you please take a look at this?  Could this be due to the
> same problems with GCC 4.6 optimizations you recently fixed on the
> trunk?  If so, we may need similar changes on the release branch.

I suspect so, because…

> Sven, could you also try with the trunk build?

The trunk is fine.  I'm already bisecting the problem, but have to leave
in 1.5 hours and will then be unavailable until Sunday.  If I find out
the commit which fixed the bug, I'll let you know.

Cheers,
       Sven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-06 10:50       ` Sven Joachim
@ 2011-05-06 12:36         ` Sven Joachim
  2011-05-06 14:39           ` Stefan Monnier
  0 siblings, 1 reply; 20+ messages in thread
From: Sven Joachim @ 2011-05-06 12:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Paul Eggert, 8623

On 2011-05-06 12:50 +0200, Sven Joachim wrote:

> On 2011-05-06 12:15 +0200, Eli Zaretskii wrote:
>
>>> From: Sven Joachim <svenjoac@gmx.de>
>>> Cc: 8623@debbugs.gnu.org
>>> Date: Thu, 05 May 2011 23:12:18 +0200
>>> 
>>> $ gcc --version | head -n1
>>> gcc (Debian 4.6.0-6) 4.6.1 20110428 (prerelease)
>>> 
>>> > Also, can you build Emacs without optimizations, and try reproducing
>>> > in the unoptimized binary?
>>> 
>>> Alas, the unoptimized binary does not crash.
>>
>> Darn!  Debugging optimized code is pretty much hopeless with current
>> versions of GCC.
>>
>> Paul, could you please take a look at this?  Could this be due to the
>> same problems with GCC 4.6 optimizations you recently fixed on the
>> trunk?  If so, we may need similar changes on the release branch.
>
> I suspect so, because…
>
>> Sven, could you also try with the trunk build?
>
> The trunk is fine.  I'm already bisecting the problem, but have to leave
> in 1.5 hours and will then be unavailable until Sunday.  If I find out
> the commit which fixed the bug, I'll let you know.

The following commit (merged into the trunk as revision 104021)
contained the fix:

,----
|     revno: 103939.1.42
|     committer: Paul Eggert <eggert@cs.ucla.edu>
|     branch nick: atest
|     timestamp: Mon 2011-04-25 00:14:46 -0700
|     message:
|       lisp.h: Fix a problem with aliasing and vector headers.
|       
|       GCC 4.6.0 optimizes based on type-based alias analysis.  For
|       example, if b is of type struct buffer * and v of type struct
|       Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
|       != &v->size, and therefore "v->size = 1; b->size = 2; return
|       v->size;" must therefore return 1.  This assumption is incorrect
|       for Emacs, since it type-puns struct Lisp_Vector * with many other
|       types.  To fix this problem, this patch adds a new type struct
|       vector_header that documents the constraints on layout of vectors
|       and pseudovectors, and helps optimizing compilers not get fooled
|       by Emacs's type punning.  It also adds the macros XSETTYPED_PVECTYPE
|       XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
|       * lisp.h (XVECTOR_SIZE): New convenience macro.  All previous uses of
|       XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
|       of writing XVECTOR (foo)->header.size.
|       (XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
|       (XSETTYPED_PVECTYPE): New macro, specifying the name of the size
|       member.
|       (XSETPVECTYPE): Rewrite in terms of new macro.
|       (XSETPVECTYPESIZE): New macro, specifying both type and size.
|       This is a bit clearer, and further avoids the possibility of
|       undesirable aliasing.
|       (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
|       (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
|       and XVECTOR_HEADER_SIZE.
|       (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
|       since Lisp_Subr is a special case (no "next" field).
|       (ASIZE): Rewrite in terms of XVECTOR_SIZE.
|       (struct vector_header): New type.
|       (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
|       object, to help avoid aliasing.
|       (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
|       (SUBRP): Likewise, since Lisp_Subr is a special case.
|       * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
|       (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
|       (struct Lisp_Hash_Table): Combine first two members into a single
|       struct vector_header member.  All uses of "size" and "next" members
|       changed to be "header.size" and "header.next".
|       * buffer.h (struct buffer): Likewise.
|       * font.h (struct font_spec, struct font_entity, struct font): Likewise.
|       * frame.h (struct frame): Likewise.
|       * process.h (struct Lisp_Process): Likewise.
|       * termhooks.h (struct terminal): Likewise.
|       * window.c (struct save_window_data, struct saved_window): Likewise.
|       * window.h (struct window): Likewise.
|       * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
|       Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
|       * buffer.c (init_buffer_once): Likewise.
|       * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
|       special case.
|       * process.c (Fformat_network_address): Use local var for size,
|       for brevity.
| 
`----

This commit touches 39 files.  How to backport it to the emacs-23 branch
is left as an exercise for the reader.

Bye,
    Sven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-06 10:15     ` Eli Zaretskii
  2011-05-06 10:50       ` Sven Joachim
@ 2011-05-06 14:37       ` Paul Eggert
  1 sibling, 0 replies; 20+ messages in thread
From: Paul Eggert @ 2011-05-06 14:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Sven Joachim, 8623

On 05/06/11 03:15, Eli Zaretskii wrote:
> Paul, could you please take a look at this?  Could this be due to the
> same problems with GCC 4.6 optimizations you recently fixed on the
> trunk?  If so, we may need similar changes on the release branch.

Yeowch.  I don't have easy access to a Debian unstable host,
and even if I did, I don't relish the job of looking into the
details as to why it crashed.

That aliasing patch was motivated by two things:
(1) I had a smoking gun in which GCC 4.6.0 clearly generated code
that would crash Emacs, when Emacs was compiled in debugging mode.
(2) I had the strong suspicion that other aliasing problems
were elsewhere in Emacs, even when not debugging, and that it
would be very difficult to track them down.

I'd guess that we're seeing (2) here, but *proving* that could
be a lot of work.

How about if we do this instead: (A) merge the aliasing patch into
Emacs 23, (B) see if this works for Sven; (C) if it does,
commit it into the 23 branch.  That should be less work than
proving that this is an instance of (2).





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-06 12:36         ` Sven Joachim
@ 2011-05-06 14:39           ` Stefan Monnier
  2011-05-06 14:47             ` Paul Eggert
  2011-05-07 11:32             ` Richard Stallman
  0 siblings, 2 replies; 20+ messages in thread
From: Stefan Monnier @ 2011-05-06 14:39 UTC (permalink / raw)
  To: Sven Joachim; +Cc: Paul Eggert, 8623

> The following commit (merged into the trunk as revision 104021)
> contained the fix:
[...]
> This commit touches 39 files.  How to backport it to the emacs-23 branch
> is left as an exercise for the reader.

So it seems clear that the problem is due to gcc 4.6.0's optimization.
Maybe rather than try to port that fix, we could tweak the makefiles so
as to disable that optimization?


        Stefan





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-06 14:39           ` Stefan Monnier
@ 2011-05-06 14:47             ` Paul Eggert
  2011-05-08 11:50               ` Sven Joachim
  2011-05-07 11:32             ` Richard Stallman
  1 sibling, 1 reply; 20+ messages in thread
From: Paul Eggert @ 2011-05-06 14:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Sven Joachim, 8623

On 05/06/11 07:39, Stefan Monnier wrote:
> So it seems clear that the problem is due to gcc 4.6.0's optimization.
> Maybe rather than try to port that fix, we could tweak the makefiles so
> as to disable that optimization?

That might be worth a try.  Sven, if you compile with -O2 -fno-strict-aliasing,
does that fix things?  And if that doesn't work, does -O2 -fno-strict-aliasing
-fno-strict-overflow do the trick?

If so, we could tweak the Emacs 23 configure.in so that the
default optimization flag is -O2 -fno-strict-aliasing instead of -O2,
when the compiler accepts the -fno-strict-aliasing flag.  That might be
easier than backporting the fix.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-06 14:39           ` Stefan Monnier
  2011-05-06 14:47             ` Paul Eggert
@ 2011-05-07 11:32             ` Richard Stallman
  1 sibling, 0 replies; 20+ messages in thread
From: Richard Stallman @ 2011-05-07 11:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eggert, svenjoac, 8623

    So it seems clear that the problem is due to gcc 4.6.0's optimization.
    Maybe rather than try to port that fix, we could tweak the makefiles so
    as to disable that optimization?

People specify their own optimizations.  Since we know what the fix is,
why not install it?

-- 
Dr Richard Stallman
President, Free Software Foundation
51 Franklin St
Boston MA 02110
USA
www.fsf.org, www.gnu.org
Skype: No way! That's nonfree (freedom-denying) software.
  Use free telephony http://directory.fsf.org/category/tel/





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-06 14:47             ` Paul Eggert
@ 2011-05-08 11:50               ` Sven Joachim
  2011-05-08 16:34                 ` Paul Eggert
  0 siblings, 1 reply; 20+ messages in thread
From: Sven Joachim @ 2011-05-08 11:50 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 8623

On 2011-05-06 16:47 +0200, Paul Eggert wrote:

> On 05/06/11 07:39, Stefan Monnier wrote:
>> So it seems clear that the problem is due to gcc 4.6.0's optimization.
>> Maybe rather than try to port that fix, we could tweak the makefiles so
>> as to disable that optimization?
>
> That might be worth a try.  Sven, if you compile with -O2 -fno-strict-aliasing,
> does that fix things?  And if that doesn't work, does -O2 -fno-strict-aliasing
> -fno-strict-overflow do the trick?

No, neither of them helps.

Cheers,
       Sven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-08 11:50               ` Sven Joachim
@ 2011-05-08 16:34                 ` Paul Eggert
  2011-05-08 17:42                   ` Sven Joachim
  0 siblings, 1 reply; 20+ messages in thread
From: Paul Eggert @ 2011-05-08 16:34 UTC (permalink / raw)
  To: Sven Joachim; +Cc: 8623

On 05/08/2011 04:50 AM, Sven Joachim wrote:
> No, neither of them helps.

OK, thanks, so instead of trying to hack around, we need to really fix
the problem.

What happens if you backport the patch in question?
You wrote that it's an "exercise for the reader", but suppose you actually
apply the patch with "patch", and try to build?  I normally don't
mess with the emacs-23 branch (and when I tried, it didn't build for me,
unfortunately; see Bug#8637), so it'd be helpful if you could report
what the integration problems are here.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-08 16:34                 ` Paul Eggert
@ 2011-05-08 17:42                   ` Sven Joachim
  2011-05-08 18:22                     ` Paul Eggert
                                       ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Sven Joachim @ 2011-05-08 17:42 UTC (permalink / raw)
  To: Paul Eggert; +Cc: 8623

On 2011-05-08 18:34 +0200, Paul Eggert wrote:

> On 05/08/2011 04:50 AM, Sven Joachim wrote:
>> No, neither of them helps.
>
> OK, thanks, so instead of trying to hack around, we need to really fix
> the problem.
>
> What happens if you backport the patch in question?

Sans src/ChangeLog, I get merge conflicts in 15 files (trying with the
git mirror and "git cherry-pick", since I'm not familiar with bzr).
Haven't really looked any further.

> You wrote that it's an "exercise for the reader", but suppose you actually
> apply the patch with "patch", and try to build?  I normally don't
> mess with the emacs-23 branch (and when I tried, it didn't build for me,
> unfortunately; see Bug#8637), so it'd be helpful if you could report
> what the integration problems are here.

Well, here is the diff after the failed cherry-pick (leaving out
src/ChangeLog):


diff --cc src/alloc.c
index ad11e21,c9496ec..0000000
--- a/src/alloc.c
+++ b/src/alloc.c
@@@ -163,13 -146,12 +163,13 @@@ static __malloc_size_t bytes_used_when_
  #define UNMARK_STRING(S)	((S)->size &= ~ARRAY_MARK_FLAG)
  #define STRING_MARKED_P(S)	(((S)->size & ARRAY_MARK_FLAG) != 0)
  
- #define VECTOR_MARK(V)		((V)->size |= ARRAY_MARK_FLAG)
- #define VECTOR_UNMARK(V)	((V)->size &= ~ARRAY_MARK_FLAG)
- #define VECTOR_MARKED_P(V)	(((V)->size & ARRAY_MARK_FLAG) != 0)
+ #define VECTOR_MARK(V)		((V)->header.size |= ARRAY_MARK_FLAG)
+ #define VECTOR_UNMARK(V)	((V)->header.size &= ~ARRAY_MARK_FLAG)
+ #define VECTOR_MARKED_P(V)	(((V)->header.size & ARRAY_MARK_FLAG) != 0)
  
 -/* Value is the number of bytes of S, a pointer to a struct Lisp_String.
 -   Be careful during GC, because S->size contains the mark bit for
 +/* Value is the number of bytes/chars of S, a pointer to a struct
 +   Lisp_String.  This must be used instead of STRING_BYTES (S) or
 +   S->size during GC, because S->size contains the mark bit for
     strings.  */
  
  #define GC_STRING_BYTES(S)	(STRING_BYTES (S))
@@@ -1151,8 -1055,9 +1151,14 @@@ allocate_buffer (
    struct buffer *b
      = (struct buffer *) lisp_malloc (sizeof (struct buffer),
  				     MEM_TYPE_BUFFER);
++<<<<<<< HEAD
 +  b->size = sizeof (struct buffer) / sizeof (EMACS_INT);
 +  XSETPVECTYPE (b, PVEC_BUFFER);
++=======
+   XSETPVECTYPESIZE (b, PVEC_BUFFER,
+ 		    ((sizeof (struct buffer) + sizeof (EMACS_INT) - 1)
+ 		     / sizeof (EMACS_INT)));
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
    return b;
  }
  
@@@ -2956,11 -2825,10 +2960,11 @@@ allocate_vectorlike (len
  /* Allocate a vector with NSLOTS slots.  */
  
  struct Lisp_Vector *
 -allocate_vector (EMACS_INT nslots)
 +allocate_vector (nslots)
 +     EMACS_INT nslots;
  {
    struct Lisp_Vector *v = allocate_vectorlike (nslots);
-   v->size = nslots;
+   v->header.size = nslots;
    return v;
  }
  
@@@ -4913,10 -4769,10 +4916,10 @@@ Does not copy symbols.  Copies strings 
    else if (COMPILEDP (obj) || VECTORP (obj))
      {
        register struct Lisp_Vector *vec;
 -      register EMACS_INT i;
 +      register int i;
        EMACS_INT size;
  
-       size = XVECTOR (obj)->size;
+       size = XVECTOR_SIZE (obj);
        if (size & PSEUDOVECTOR_FLAG)
  	size &= PSEUDOVECTOR_SIZE_MASK;
        vec = XVECTOR (make_pure_vector (size));
@@@ -5182,9 -5049,9 +5185,9 @@@ returns nil, because real GC can't be d
  	  }
  	/* Now that we have stripped the elements that need not be in the
  	   undo_list any more, we can finally mark the list.  */
 -	mark_object (nextb->BUFFER_INTERNAL_FIELD (undo_list));
 +	mark_object (nextb->undo_list);
  
- 	nextb = nextb->next;
+ 	nextb = nextb->header.next.buffer;
        }
    }
  
@@@ -5355,14 -5220,13 +5358,19 @@@ int last_marked_index
     links of a list, in mark_object.  In debugging,
     the call to abort will hit a breakpoint.
     Normally this is zero and the check never goes off.  */
 -static size_t mark_object_loop_halt;
 +static int mark_object_loop_halt;
  
  static void
 -mark_vectorlike (struct Lisp_Vector *ptr)
 +mark_vectorlike (ptr)
 +     struct Lisp_Vector *ptr;
  {
++<<<<<<< HEAD
 +  register EMACS_INT size = ptr->size;
 +  register int i;
++=======
+   register EMACS_UINT size = ptr->header.size;
+   register EMACS_UINT i;
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  
    eassert (!VECTOR_MARKED_P (ptr));
    VECTOR_MARK (ptr);		/* Else mark it */
@@@ -5382,11 -5246,10 +5390,16 @@@
     symbols.  */
  
  static void
 -mark_char_table (struct Lisp_Vector *ptr)
 +mark_char_table (ptr)
 +     struct Lisp_Vector *ptr;
  {
++<<<<<<< HEAD
 +  register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK;
 +  register int i;
++=======
+   register EMACS_UINT size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK;
+   register EMACS_UINT i;
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  
    eassert (!VECTOR_MARKED_P (ptr));
    VECTOR_MARK (ptr);
@@@ -5516,8 -5377,8 +5529,13 @@@ mark_object (arg
  	   recursion there.  */
  	{
  	  register struct Lisp_Vector *ptr = XVECTOR (obj);
++<<<<<<< HEAD
 +	  register EMACS_INT size = ptr->size;
 +	  register int i;
++=======
+ 	  register EMACS_UINT size = ptr->header.size;
+ 	  register EMACS_UINT i;
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  
  	  CHECK_LIVE (live_vector_p);
  	  VECTOR_MARK (ptr);	/* Else mark it */
diff --cc src/buffer.c
index 076495c,6ced4fb..0000000
--- a/src/buffer.c
+++ b/src/buffer.c
@@@ -630,10 -585,10 +630,10 @@@ CLONE nil means the indirect buffer's s
  
    b->newline_cache = 0;
    b->width_run_cache = 0;
 -  BVAR (b, width_table) = Qnil;
 +  b->width_table = Qnil;
  
    /* Put this on the chain of all buffers including killed ones.  */
-   b->next = all_buffers;
+   b->header.next.buffer = all_buffers;
    all_buffers = b;
  
    name = Fcopy_sequence (name);
@@@ -1544,14 -1458,14 +1544,14 @@@ with SIGHUP.  */
  
        GCPRO1 (buffer);
  
-       for (other = all_buffers; other; other = other->next)
+       for (other = all_buffers; other; other = other->header.next.buffer)
  	/* all_buffers contains dead buffers too;
  	   don't re-kill them.  */
 -	if (other->base_buffer == b && !NILP (BVAR (other, name)))
 +	if (other->base_buffer == b && !NILP (other->name))
  	  {
 -	    Lisp_Object buf;
 -	    XSETBUFFER (buf, other);
 -	    Fkill_buffer (buf);
 +	    Lisp_Object buffer;
 +	    XSETBUFFER (buffer, other);
 +	    Fkill_buffer (buffer);
  	  }
  
        UNGCPRO;
@@@ -2585,11 -2476,11 +2585,16 @@@ current buffer is cleared.  */
  
    /* Copy this buffer's new multibyte status
       into all of its indirect buffers.  */
++<<<<<<< HEAD
 +  for (other = all_buffers; other; other = other->next)
 +    if (other->base_buffer == current_buffer && !NILP (other->name))
++=======
+   for (other = all_buffers; other; other = other->header.next.buffer)
+     if (other->base_buffer == current_buffer && !NILP (BVAR (other, name)))
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
        {
 -	BVAR (other, enable_multibyte_characters)
 -	  = BVAR (current_buffer, enable_multibyte_characters);
 +	other->enable_multibyte_characters
 +	  = current_buffer->enable_multibyte_characters;
  	other->prevent_redisplay_optimizations_p = 1;
        }
  
@@@ -4343,13 -4176,12 +4348,13 @@@ static int last_overlay_modification_ho
     to the end of last_overlay_modification_hooks.  */
  
  static void
 -add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay)
 +add_overlay_mod_hooklist (functionlist, overlay)
 +     Lisp_Object functionlist, overlay;
  {
-   int oldsize = XVECTOR (last_overlay_modification_hooks)->size;
+   int oldsize = XVECTOR_SIZE (last_overlay_modification_hooks);
  
    if (last_overlay_modification_hooks_used == oldsize)
 -    last_overlay_modification_hooks = larger_vector
 +    last_overlay_modification_hooks = larger_vector 
        (last_overlay_modification_hooks, oldsize * 2, Qnil);
    ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used,
  	functionlist); last_overlay_modification_hooks_used++;
diff --cc src/bytecode.c
index db80f5b,839e0f7..0000000
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@@ -437,6 -466,10 +437,13 @@@ If the third argument is incorrect, Ema
    CHECK_VECTOR (vector);
    CHECK_NUMBER (maxdepth);
  
++<<<<<<< HEAD
++=======
+ #ifdef BYTE_CODE_SAFE
+   const_length = XVECTOR_SIZE (vector);
+ #endif
+ 
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
    if (STRING_MULTIBYTE (bytestr))
      /* BYTESTR must have been produced by Emacs 20.2 or the earlier
         because they produced a raw 8-bit string for byte-code and now
diff --cc src/composite.c
index a9376c0,aa60900..0000000
--- a/src/composite.c
+++ b/src/composite.c
@@@ -300,7 -293,7 +300,11 @@@ get_composition_id (charpos, bytepos, n
      }
    else if (VECTORP (components) || CONSP (components))
      {
++<<<<<<< HEAD
 +      int len = XVECTOR (key)->size;
++=======
+       EMACS_UINT len = XVECTOR_SIZE (key);
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  
        /* The number of elements should be odd.  */
        if ((len % 2) == 0)
diff --cc src/data.c
index 0c7cb24,68ea503..0000000
--- a/src/data.c
+++ b/src/data.c
@@@ -1378,53 -1336,70 +1378,67 @@@ DEFUN ("set-default", Fset_default, Sse
         doc: /* Set SYMBOL's default value to VALUE.  SYMBOL and VALUE are evaluated.
  The default value is seen in buffers that do not have their own values
  for this variable.  */)
 -  (Lisp_Object symbol, Lisp_Object value)
 +     (symbol, value)
 +     Lisp_Object symbol, value;
  {
 -  struct Lisp_Symbol *sym;
 +  register Lisp_Object valcontents, current_alist_element, alist_element_buffer;
  
    CHECK_SYMBOL (symbol);
 -  if (SYMBOL_CONSTANT_P (symbol))
 -    {
 -      if (NILP (Fkeywordp (symbol))
 -	  || !EQ (value, Fdefault_value (symbol)))
 -	xsignal1 (Qsetting_constant, symbol);
 -      else
 -	/* Allow setting keywords to their own value.  */
 -	return value;
 -    }
 -  sym = XSYMBOL (symbol);
 +  valcontents = SYMBOL_VALUE (symbol);
  
 - start:
 -  switch (sym->redirect)
 +  /* Handle variables like case-fold-search that have special slots
 +     in the buffer.  Make them work apparently like Lisp_Buffer_Local_Value
 +     variables.  */
 +  if (BUFFER_OBJFWDP (valcontents))
      {
 -    case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
 -    case SYMBOL_PLAINVAL: return Fset (symbol, value);
 -    case SYMBOL_LOCALIZED:
 -      {
 -	struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
 +      int offset = XBUFFER_OBJFWD (valcontents)->offset;
 +      int idx = PER_BUFFER_IDX (offset);
  
 -	/* Store new value into the DEFAULT-VALUE slot.  */
 -	XSETCDR (blv->defcell, value);
 +      PER_BUFFER_DEFAULT (offset) = value;
  
 -	/* If the default binding is now loaded, set the REALVALUE slot too.  */
 -	if (blv->fwd && EQ (blv->defcell, blv->valcell))
 -	  store_symval_forwarding (blv->fwd, value, NULL);
 -	return value;
 -      }
 -    case SYMBOL_FORWARDED:
 -      {
 -	union Lisp_Fwd *valcontents = SYMBOL_FWD (sym);
 +      /* If this variable is not always local in all buffers,
 +	 set it in the buffers that don't nominally have a local value.  */
 +      if (idx > 0)
 +	{
 +	  struct buffer *b;
  
 -	/* Handle variables like case-fold-search that have special slots
 -	   in the buffer.
 -	   Make them work apparently like Lisp_Buffer_Local_Value variables.  */
 -	if (BUFFER_OBJFWDP (valcontents))
 -	  {
 -	    int offset = XBUFFER_OBJFWD (valcontents)->offset;
 -	    int idx = PER_BUFFER_IDX (offset);
 +	  for (b = all_buffers; b; b = b->next)
 +	    if (!PER_BUFFER_VALUE_P (b, idx))
 +	      PER_BUFFER_VALUE (b, offset) = value;
 +	}
 +      return value;
 +    }
 +
 +  if (!BUFFER_LOCAL_VALUEP (valcontents))
 +    return Fset (symbol, value);
  
 -	    PER_BUFFER_DEFAULT (offset) = value;
 +  /* Store new value into the DEFAULT-VALUE slot.  */
 +  XSETCDR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, value);
  
 -	    /* If this variable is not always local in all buffers,
 -	       set it in the buffers that don't nominally have a local value.  */
 -	    if (idx > 0)
 -	      {
 -		struct buffer *b;
++<<<<<<< HEAD
 +  /* If the default binding is now loaded, set the REALVALUE slot too.  */
 +  current_alist_element
 +    = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr);
 +  alist_element_buffer = Fcar (current_alist_element);
 +  if (EQ (alist_element_buffer, current_alist_element))
 +    store_symval_forwarding (symbol,
 +			     XBUFFER_LOCAL_VALUE (valcontents)->realvalue,
 +			     value, NULL);
  
 +  return value;
++=======
+ 		for (b = all_buffers; b; b = b->header.next.buffer)
+ 		  if (!PER_BUFFER_VALUE_P (b, idx))
+ 		    PER_BUFFER_VALUE (b, offset) = value;
+ 	      }
+ 	    return value;
+ 	  }
+ 	else
+ 	  return Fset (symbol, value);
+       }
+     default: abort ();
+     }
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  }
  
  DEFUN ("setq-default", Fsetq_default, Ssetq_default, 0, UNEVALLED, 0,
diff --cc src/disptab.h
index 92a4270,76fc586..0000000
--- a/src/disptab.h
+++ b/src/disptab.h
@@@ -103,6 -95,3 +103,9 @@@ extern Lisp_Object Vglyph_table
  
  #define SET_GLYPH_FROM_CHAR(glyph, c) \
    SET_GLYPH (glyph, c, DEFAULT_FACE_ID)
++<<<<<<< HEAD
 +
 +/* arch-tag: d7f792d2-f59c-4904-a91e-91522e3ab349
 +   (do not change this comment) */
++=======
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
diff --cc src/fns.c
index 064c4d2,a128b92..0000000
--- a/src/fns.c
+++ b/src/fns.c
@@@ -4022,9 -3681,9 +4022,15 @@@ copy_hash_table (h1
    struct Lisp_Vector *next;
  
    h2 = allocate_hash_table ();
++<<<<<<< HEAD
 +  next = h2->vec_next;
 +  bcopy (h1, h2, sizeof *h2);
 +  h2->vec_next = next;
++=======
+   next = h2->header.next.vector;
+   memcpy (h2, h1, sizeof *h2);
+   h2->header.next.vector = next;
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
    h2->key_and_value = Fcopy_sequence (h1->key_and_value);
    h2->hash = Fcopy_sequence (h1->hash);
    h2->next = Fcopy_sequence (h1->next);
diff --cc src/indent.c
index e92e6b2,a5ac2ab..0000000
--- a/src/indent.c
+++ b/src/indent.c
@@@ -152,10 -140,10 +152,17 @@@ recompute_width_table (buf, disptab
    int i;
    struct Lisp_Vector *widthtab;
  
++<<<<<<< HEAD
 +  if (!VECTORP (buf->width_table))
 +    buf->width_table = Fmake_vector (make_number (256), make_number (0));
 +  widthtab = XVECTOR (buf->width_table);
 +  if (widthtab->size != 256)
++=======
+   if (!VECTORP (BVAR (buf, width_table)))
+     BVAR (buf, width_table) = Fmake_vector (make_number (256), make_number (0));
+   widthtab = XVECTOR (BVAR (buf, width_table));
+   if (widthtab->header.size != 256)
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
      abort ();
  
    for (i = 0; i < 256; i++)
@@@ -300,12 -283,10 +307,17 @@@ skip_invisible (pos, next_boundary_p, t
        width = bytes * 4;						\
      else								\
        {									\
++<<<<<<< HEAD
 +	if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))		\
 +	  width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size;		\
++=======
+ 	if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, ch)))		\
+ 	  width = XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, ch));		\
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  	else								\
 -	  width = CHAR_WIDTH (ch);					\
 +	  width = CHAR_WIDTH (c);					\
 +	if (width > 1)							\
 +	  wide_column = width;						\
        }									\
    } while (0)
  
@@@ -1150,16 -1118,16 +1162,16 @@@ compute_motion (from, fromvpos, fromhpo
    register EMACS_INT pos;
    EMACS_INT pos_byte;
    register int c = 0;
 -  register EMACS_INT tab_width = XFASTINT (BVAR (current_buffer, tab_width));
 -  register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
 +  register EMACS_INT tab_width = XFASTINT (current_buffer->tab_width);
 +  register int ctl_arrow = !NILP (current_buffer->ctl_arrow);
    register struct Lisp_Char_Table *dp = window_display_table (win);
 -  EMACS_INT selective
 -    = (INTEGERP (BVAR (current_buffer, selective_display))
 -       ? XINT (BVAR (current_buffer, selective_display))
 -       : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
 +  int selective
 +    = (INTEGERP (current_buffer->selective_display)
 +       ? XINT (current_buffer->selective_display)
 +       : !NILP (current_buffer->selective_display) ? -1 : 0);
    int selective_rlen
      = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
-        ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0);
+        ? XVECTOR_SIZE (DISP_INVIS_VECTOR (dp)) : 0);
    /* The next location where the `invisible' property changes, or an
       overlay starts or ends.  */
    EMACS_INT next_boundary = from;
diff --cc src/keyboard.c
index 6a63caa,8c4f7bd..0000000
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@@ -130,14 -130,11 +130,14 @@@ int this_command_key_count_reset
  
  /* This vector is used as a buffer to record the events that were actually read
     by read_key_sequence.  */
 -static Lisp_Object raw_keybuf;
 -static int raw_keybuf_count;
 +Lisp_Object raw_keybuf;
 +int raw_keybuf_count;
 +
 +/* Non-nil if the present key sequence was obtained by shift translation.  */
 +Lisp_Object Vthis_command_keys_shift_translated;
  
  #define GROW_RAW_KEYBUF							\
-  if (raw_keybuf_count == XVECTOR (raw_keybuf)->size)			\
+  if (raw_keybuf_count == XVECTOR_SIZE (raw_keybuf))			\
     raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil)  \
  
  /* Number of elements of this_command_keys
@@@ -3200,11 -2895,11 +3200,19 @@@ read_char (commandflag, nmaps, maps, pr
        if (XINT (c) == -1)
  	goto exit;
  
++<<<<<<< HEAD
 +      if ((STRINGP (current_kboard->Vkeyboard_translate_table)
 +	   && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c))
 +	  || (VECTORP (current_kboard->Vkeyboard_translate_table)
 +	      && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c))
 +	  || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table)
++=======
+       if ((STRINGP (KVAR (current_kboard, Vkeyboard_translate_table))
+ 	   && SCHARS (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c))
+ 	  || (VECTORP (KVAR (current_kboard, Vkeyboard_translate_table))
+ 	      && XVECTOR_SIZE (KVAR (current_kboard, Vkeyboard_translate_table)) > (unsigned) XFASTINT (c))
+ 	  || (CHAR_TABLE_P (KVAR (current_kboard, Vkeyboard_translate_table))
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  	      && CHARACTERP (c)))
  	{
  	  Lisp_Object d;
@@@ -4640,13 -4285,15 +4648,13 @@@ timer_check_2 (
        Lisp_Object *vector;
        Lisp_Object timer = Qnil, idle_timer = Qnil;
        EMACS_TIME timer_time, idle_timer_time;
 -      EMACS_TIME difference;
 -      EMACS_TIME timer_difference IF_LINT (= {0});
 -      EMACS_TIME idle_timer_difference IF_LINT (= {0});
 +      EMACS_TIME difference, timer_difference, idle_timer_difference;
  
        /* Skip past invalid timers and timers already handled.  */
 -      if (CONSP (timers))
 +      if (!NILP (timers))
  	{
  	  timer = XCAR (timers);
- 	  if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+ 	  if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
  	    {
  	      timers = XCDR (timers);
  	      continue;
@@@ -4661,10 -4308,10 +4669,10 @@@
  	      continue;
  	    }
  	}
 -      if (CONSP (idle_timers))
 +      if (!NILP (idle_timers))
  	{
  	  timer = XCAR (idle_timers);
- 	  if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+ 	  if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
  	    {
  	      idle_timers = XCDR (idle_timers);
  	      continue;
@@@ -7864,15 -7477,18 +7872,30 @@@ menu_bar_items (old
      }
  
    /* Add nil, nil, nil, nil at the end.  */
++<<<<<<< HEAD
 +  i = menu_bar_items_index;
 +  if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
 +    menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
 +  /* Add this item.  */
 +  XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
 +  XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
 +  XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
 +  XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
 +  menu_bar_items_index = i;
++=======
+   {
+     int i = menu_bar_items_index;
+     if (i + 4 > XVECTOR_SIZE (menu_bar_items_vector))
+       menu_bar_items_vector =
+ 	larger_vector (menu_bar_items_vector, 2 * i, Qnil);
+     /* Add this item.  */
+     XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
+     XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
+     XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
+     XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
+     menu_bar_items_index = i;
+   }
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  
    Vinhibit_quit = oquit;
    return menu_bar_items_vector;
@@@ -8571,9 -8217,9 +8594,9 @@@ parse_tool_bar_item (key, item
  	      PROP (TOOL_BAR_ITEM_TYPE) = type;
  	    }
  	}
 -      else if (EQ (ikey, QCimage)
 +      else if (EQ (key, QCimage)
  	       && (CONSP (value)
- 		   || (VECTORP (value) && XVECTOR (value)->size == 4)))
+ 		   || (VECTORP (value) && XVECTOR_SIZE (value) == 4)))
  	/* Value is either a single image specification or a vector
  	   of 4 such specifications for the different button states.  */
  	PROP (TOOL_BAR_ITEM_IMAGES) = value;
@@@ -10244,8 -9926,8 +10267,13 @@@ read_key_sequence (keybuf, bufsize, pro
  	      /* Treat uppercase keys as shifted.  */
  	      || (INTEGERP (key)
  		  && (KEY_TO_CHAR (key)
++<<<<<<< HEAD
 +		      < XCHAR_TABLE (current_buffer->downcase_table)->size)
 +		  && UPPERCASEP (KEY_TO_CHAR (key))))
++=======
+ 		      < XCHAR_TABLE (BVAR (current_buffer, downcase_table))->header.size)
+ 		  && uppercasep (KEY_TO_CHAR (key))))
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  	    {
  	      Lisp_Object new_key
  		= (modifiers & shift_modifier
diff --cc src/keymap.c
index b3c1400,110447b..0000000
--- a/src/keymap.c
+++ b/src/keymap.c
@@@ -3253,13 -3121,13 +3253,18 @@@ key             binding\n
        /* Delete from MAPS each element that is for the menu bar.  */
        for (list = maps; CONSP (list); list = XCDR (list))
  	{
 -	  Lisp_Object elt, elt_prefix, tem;
 +	  Lisp_Object elt, prefix, tem;
  
  	  elt = XCAR (list);
++<<<<<<< HEAD
 +	  prefix = Fcar (elt);
 +	  if (XVECTOR (prefix)->size >= 1)
++=======
+ 	  elt_prefix = Fcar (elt);
+ 	  if (XVECTOR_SIZE (elt_prefix) >= 1)
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  	    {
 -	      tem = Faref (elt_prefix, make_number (0));
 +	      tem = Faref (prefix, make_number (0));
  	      if (EQ (tem, Qmenu_bar))
  		maps = Fdelq (elt, maps);
  	    }
@@@ -3299,8 -3167,8 +3304,13 @@@
  
  	  /* If the sequence by which we reach this keymap is zero-length,
  	     then the shadow map for this keymap is just SHADOW.  */
++<<<<<<< HEAD
 +	  if ((STRINGP (prefix) && SCHARS (prefix) == 0)
 +	      || (VECTORP (prefix) && XVECTOR (prefix)->size == 0))
++=======
+ 	  if ((STRINGP (elt_prefix) && SCHARS (elt_prefix) == 0)
+ 	      || (VECTORP (elt_prefix) && XVECTOR_SIZE (elt_prefix) == 0))
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  	    ;
  	  /* If the sequence by which we reach this keymap actually has
  	     some elements, then the sequence's definition in SHADOW is
diff --cc src/lisp.h
index 34330b0,e717e7c..0000000
--- a/src/lisp.h
+++ b/src/lisp.h
@@@ -774,17 -790,21 +786,32 @@@ struct Lisp_Strin
      unsigned char *data;
    };
  
++<<<<<<< HEAD
 +#ifdef offsetof
 +#define OFFSETOF(type,field) offsetof(type,field)
 +#else
 +#define OFFSETOF(type,field) \
 +  ((int)((char*)&((type*)0)->field - (char*)0))
 +#endif
 +
 +struct Lisp_Vector
++=======
+ /* Header of vector-like objects.  This type documents the constraints on
+    layout of vectors and pseudovectors, and helps optimizing compilers not get
+    fooled by Emacs's type punning.  */
+ struct vector_header
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
    {
      EMACS_UINT size;
-     struct Lisp_Vector *next;
+     union {
+       struct buffer *buffer;
+       struct Lisp_Vector *vector;
+     } next;
+   };
+ 
+ struct Lisp_Vector
+   {
+     struct vector_header header;
      Lisp_Object contents[1];
    };
  
@@@ -1551,18 -1639,16 +1574,18 @@@ typedef struct 
  #define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
  
  #define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
- #define VECTORP(x)    (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
+ #define VECTORP(x)    (VECTORLIKEP (x) && !(XVECTOR_SIZE (x) & PSEUDOVECTOR_FLAG))
  #define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
  #define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
 +#define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
 +#define BOOLFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Boolfwd)
 +#define OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Objfwd)
 +#define BUFFER_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Objfwd)
 +#define BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Buffer_Local_Value)
 +#define SOME_BUFFER_LOCAL_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Some_Buffer_Local_Value)
 +#define KBOARD_OBJFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Kboard_Objfwd)
  #define SAVE_VALUEP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Save_Value)
  
 -#define INTFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Int)
 -#define BOOLFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Bool)
 -#define OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Obj)
 -#define BUFFER_OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Buffer_Obj)
 -#define KBOARD_OBJFWDP(x) (XFWDTYPE (x) == Lisp_Fwd_Kboard_Obj)
  
  /* True if object X is a pseudovector whose code is CODE.  */
  #define PSEUDOVECTORP(x, code)					\
diff --cc src/minibuf.c
index 90df137,b73b241..0000000
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@@ -1326,8 -1227,8 +1326,13 @@@ is used to further constrain the set o
    if (type == obarray_table)
      {
        collection = check_obarray (collection);
++<<<<<<< HEAD
 +      obsize = XVECTOR (collection)->size;
 +      bucket = XVECTOR (collection)->contents[index];
++=======
+       obsize = XVECTOR_SIZE (collection);
+       bucket = XVECTOR (collection)->contents[idx];
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
      }
  
    while (1)
@@@ -1590,8 -1490,8 +1595,13 @@@ with a space are ignored unless STRING 
    if (type == 2)
      {
        collection = check_obarray (collection);
++<<<<<<< HEAD
 +      obsize = XVECTOR (collection)->size;
 +      bucket = XVECTOR (collection)->contents[index];
++=======
+       obsize = XVECTOR_SIZE (collection);
+       bucket = XVECTOR (collection)->contents[idx];
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
      }
  
    while (1)
diff --cc src/print.c
index 682212d,8f55904..0000000
--- a/src/print.c
+++ b/src/print.c
@@@ -2046,24 -1781,24 +2046,34 @@@ print_object (obj, printcharfun, escape
  	    {
  	      PRINTCHAR (' ');
  	      PRINTCHAR ('\'');
 -	      strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun);
 +	      strout (SDATA (SYMBOL_NAME (h->test)), -1, -1, printcharfun, 0);
  	      PRINTCHAR (' ');
 -	      strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun);
 +	      strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0);
  	      PRINTCHAR (' ');
  	      sprintf (buf, "%ld/%ld", (long) h->count,
++<<<<<<< HEAD
 +		       (long) XVECTOR (h->next)->size);
 +	      strout (buf, -1, -1, printcharfun, 0);
++=======
+ 		       (long) XVECTOR_SIZE (h->next));
+ 	      strout (buf, -1, -1, printcharfun);
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  	    }
  	  sprintf (buf, " 0x%lx", (unsigned long) h);
 -	  strout (buf, -1, -1, printcharfun);
 +	  strout (buf, -1, -1, printcharfun, 0);
  	  PRINTCHAR ('>');
  #endif
  	  /* Implement a readable output, e.g.:
  	    #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
  	  /* Always print the size. */
  	  sprintf (buf, "#s(hash-table size %ld",
++<<<<<<< HEAD
 +		   (long) XVECTOR (h->next)->size);
 +	  strout (buf, -1, -1, printcharfun, 0);
++=======
+ 		   (long) XVECTOR_SIZE (h->next));
+ 	  strout (buf, -1, -1, printcharfun);
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  
  	  if (!NILP (h->test))
  	    {
@@@ -2354,12 -2025,12 +2364,16 @@@
  	if (MISCP (obj))
  	  sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
  	else if (VECTORLIKEP (obj))
++<<<<<<< HEAD
 +	  sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size);
++=======
+ 	  sprintf (buf, "(PVEC 0x%08lx)", (unsigned long) XVECTOR_SIZE (obj));
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
  	else
  	  sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
 -	strout (buf, -1, -1, printcharfun);
 +	strout (buf, -1, -1, printcharfun, 0);
  	strout (" Save your buffers immediately and please report this bug>",
 -		-1, -1, printcharfun);
 +		-1, -1, printcharfun, 0);
        }
      }
  
diff --cc src/w32font.c
index 0f01ceb,a9fa525..0000000
--- a/src/w32font.c
+++ b/src/w32font.c
@@@ -2654,6 -2581,3 +2654,9 @@@ versions of Windows) characters.  */)
    w32font_driver.type = Qgdi;
    register_font_driver (&w32font_driver, NULL);
  }
++<<<<<<< HEAD
 +
 +/* arch-tag: 65b8a3cd-46aa-4c0d-a1f3-99e75b9c07ee
 +   (do not change this comment) */
++=======
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
diff --cc src/xmenu.c
index c2e70e1,aac7fd4..0000000
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@@ -1056,13 -1011,13 +1056,21 @@@ set_frame_menubar (f, first_time, deep_
  
        menu_items = f->menu_bar_vector;
        menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
++<<<<<<< HEAD
 +      submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
 +      submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
 +      submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int));
 +      submenu_top_level_items
 +	= (int *) alloca (XVECTOR (items)->size * sizeof (int *));
++=======
+       subitems = XVECTOR_SIZE (items) / 4;
+       submenu_start = (int *) alloca (subitems * sizeof (int *));
+       submenu_end = (int *) alloca (subitems * sizeof (int *));
+       submenu_n_panes = (int *) alloca (subitems * sizeof (int));
+       submenu_top_level_items = (int *) alloca (subitems * sizeof (int *));
++>>>>>>> 1c05634... lisp.h: Fix a problem with aliasing and vector headers.
        init_menu_items ();
 -      for (i = 0; i < subitems; i++)
 +      for (i = 0; i < XVECTOR (items)->size; i += 4)
  	{
  	  Lisp_Object key, string, maps;
  






^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-08 17:42                   ` Sven Joachim
@ 2011-05-08 18:22                     ` Paul Eggert
  2011-05-08 19:02                     ` Eli Zaretskii
  2011-05-08 19:27                     ` Eli Zaretskii
  2 siblings, 0 replies; 20+ messages in thread
From: Paul Eggert @ 2011-05-08 18:22 UTC (permalink / raw)
  To: Sven Joachim; +Cc: 8623

On 05/08/11 10:42, Sven Joachim wrote:
> Well, here is the diff after the failed cherry-pick (leaving out
> src/ChangeLog):

Thanks.  It looks like this will take some work.  I'll add it to
my list of things to do, but I'm afraid other things are more pressing
right now (not to mention being more fun than backporting :-).





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-08 17:42                   ` Sven Joachim
  2011-05-08 18:22                     ` Paul Eggert
@ 2011-05-08 19:02                     ` Eli Zaretskii
  2011-05-09 10:10                       ` Eli Zaretskii
  2011-05-08 19:27                     ` Eli Zaretskii
  2 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2011-05-08 19:02 UTC (permalink / raw)
  To: Sven Joachim; +Cc: eggert, 8623

> From: Sven Joachim <svenjoac@gmx.de>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  Eli Zaretskii <eliz@gnu.org>,  8623@debbugs.gnu.org
> Date: Sun, 08 May 2011 19:42:51 +0200
> 
> Sans src/ChangeLog, I get merge conflicts in 15 files (trying with the
> git mirror and "git cherry-pick", since I'm not familiar with bzr).

bzr doesn't give any merge conflicts in src/ChangeLog (but I have the
changelog_merge plugin installed).  The way to cherry-pick with bzr is
this:

   cd emacs-23 && bzr merge -r103939.1.41..103939.1.42 ../trunk

because the changes you want were committed in revision 103939.1.42.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-08 17:42                   ` Sven Joachim
  2011-05-08 18:22                     ` Paul Eggert
  2011-05-08 19:02                     ` Eli Zaretskii
@ 2011-05-08 19:27                     ` Eli Zaretskii
  2011-05-09 10:13                       ` Eli Zaretskii
  2 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2011-05-08 19:27 UTC (permalink / raw)
  To: Sven Joachim; +Cc: eggert, 8623

> From: Sven Joachim <svenjoac@gmx.de>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  Eli Zaretskii <eliz@gnu.org>,  8623@debbugs.gnu.org
> Date: Sun, 08 May 2011 19:42:51 +0200
> 
> Well, here is the diff after the failed cherry-pick (leaving out
> src/ChangeLog):

Try the one below, I tried to resolve all the conflicts.  Caveat: I
didn't attempt to build it, so it's possible that you will need a few
more tweaks.

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2011-04-29 14:23:44 +0000
+++ src/ChangeLog	2011-05-08 18:32:58 +0000
@@ -1,3 +1,58 @@
+2011-05-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+	lisp.h: Fix a problem with aliasing and vector headers.
+	GCC 4.6.0 optimizes based on type-based alias analysis.  For
+	example, if b is of type struct buffer * and v of type struct
+	Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
+	!= &v->size, and therefore "v->size = 1; b->size = 2; return
+	v->size;" must therefore return 1.  This assumption is incorrect
+	for Emacs, since it type-puns struct Lisp_Vector * with many other
+	types.  To fix this problem, this patch adds a new type struct
+	vector_header that documents the constraints on layout of vectors
+	and pseudovectors, and helps optimizing compilers not get fooled
+	by Emacs's type punning.  It also adds the macros XSETTYPED_PVECTYPE
+	XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
+	* lisp.h (XVECTOR_SIZE): New convenience macro.  All previous uses of
+	XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
+	of writing XVECTOR (foo)->header.size.
+	(XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
+	(XSETTYPED_PVECTYPE): New macro, specifying the name of the size
+	member.
+	(XSETPVECTYPE): Rewrite in terms of new macro.
+	(XSETPVECTYPESIZE): New macro, specifying both type and size.
+	This is a bit clearer, and further avoids the possibility of
+	undesirable aliasing.
+	(XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
+	(XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
+	and XVECTOR_HEADER_SIZE.
+	(XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
+	since Lisp_Subr is a special case (no "next" field).
+	(ASIZE): Rewrite in terms of XVECTOR_SIZE.
+	(struct vector_header): New type.
+	(TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
+	object, to help avoid aliasing.
+	(PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
+	(SUBRP): Likewise, since Lisp_Subr is a special case.
+	* lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
+	(struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
+	(struct Lisp_Hash_Table): Combine first two members into a single
+	struct vector_header member.  All uses of "size" and "next" members
+	changed to be "header.size" and "header.next".
+	* buffer.h (struct buffer): Likewise.
+	* font.h (struct font_spec, struct font_entity, struct font): Likewise.
+	* frame.h (struct frame): Likewise.
+	* process.h (struct Lisp_Process): Likewise.
+	* termhooks.h (struct terminal): Likewise.
+	* window.c (struct save_window_data, struct saved_window): Likewise.
+	* window.h (struct window): Likewise.
+	* alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
+	Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
+	* buffer.c (init_buffer_once): Likewise.
+	* lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
+	special case.
+	* process.c (Fformat_network_address): Use local var for size,
+	for brevity.
+
 2011-04-29  Eli Zaretskii  <eliz@gnu.org>
 
 	* w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]:

=== modified file 'src/alloc.c'
--- src/alloc.c	2011-01-02 23:50:46 +0000
+++ src/alloc.c	2011-05-08 19:05:21 +0000
@@ -163,9 +163,9 @@ static __malloc_size_t bytes_used_when_r
 #define UNMARK_STRING(S)	((S)->size &= ~ARRAY_MARK_FLAG)
 #define STRING_MARKED_P(S)	(((S)->size & ARRAY_MARK_FLAG) != 0)
 
-#define VECTOR_MARK(V)		((V)->size |= ARRAY_MARK_FLAG)
-#define VECTOR_UNMARK(V)	((V)->size &= ~ARRAY_MARK_FLAG)
-#define VECTOR_MARKED_P(V)	(((V)->size & ARRAY_MARK_FLAG) != 0)
+#define VECTOR_MARK(V)		((V)->header.size |= ARRAY_MARK_FLAG)
+#define VECTOR_UNMARK(V)	((V)->header.size &= ~ARRAY_MARK_FLAG)
+#define VECTOR_MARKED_P(V)	(((V)->header.size & ARRAY_MARK_FLAG) != 0)
 
 /* Value is the number of bytes/chars of S, a pointer to a struct
    Lisp_String.  This must be used instead of STRING_BYTES (S) or
@@ -1151,8 +1151,9 @@ allocate_buffer ()
   struct buffer *b
     = (struct buffer *) lisp_malloc (sizeof (struct buffer),
 				     MEM_TYPE_BUFFER);
-  b->size = sizeof (struct buffer) / sizeof (EMACS_INT);
-  XSETPVECTYPE (b, PVEC_BUFFER);
+  XSETPVECTYPESIZE (b, PVEC_BUFFER,
+		    ((sizeof (struct buffer) + sizeof (EMACS_INT) - 1)
+		     / sizeof (EMACS_INT)));
   return b;
 }
 
@@ -2341,10 +2342,8 @@ LENGTH must be a number.  INIT matters o
      slot `size' of the struct Lisp_Bool_Vector.  */
   val = Fmake_vector (make_number (length_in_elts + 1), Qnil);
 
-  /* Get rid of any bits that would cause confusion.  */
-  XVECTOR (val)->size = 0;	/* No Lisp_Object to trace in there.  */
-  /* Use  XVECTOR (val) rather than `p' because p->size is not TRT. */
-  XSETPVECTYPE (XVECTOR (val), PVEC_BOOL_VECTOR);
+  /* No Lisp_Object to trace in there.  */
+  XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0);
 
   p = XBOOL_VECTOR (val);
   p->size = XFASTINT (length);
@@ -2943,7 +2942,7 @@ allocate_vectorlike (len)
   consing_since_gc += nbytes;
   vector_cells_consed += len;
 
-  p->next = all_vectors;
+  p->header.next.vector = all_vectors;
   all_vectors = p;
 
   MALLOC_UNBLOCK_INPUT;
@@ -2960,7 +2959,7 @@ allocate_vector (nslots)
      EMACS_INT nslots;
 {
   struct Lisp_Vector *v = allocate_vectorlike (nslots);
-  v->size = nslots;
+  v->header.size = nslots;
   return v;
 }
 
@@ -2976,11 +2975,10 @@ allocate_pseudovector (memlen, lisplen, 
   EMACS_INT i;
 
   /* Only the first lisplen slots will be traced normally by the GC.  */
-  v->size = lisplen;
   for (i = 0; i < lisplen; ++i)
     v->contents[i] = Qnil;
 
-  XSETPVECTYPE (v, tag);	/* Add the appropriate tag.  */
+  XSETPVECTYPESIZE (v, tag, lisplen);
   return v;
 }
 
@@ -4884,7 +4882,7 @@ make_pure_vector (len)
 
   p = (struct Lisp_Vector *) pure_alloc (size, Lisp_Vectorlike);
   XSETVECTOR (new, p);
-  XVECTOR (new)->size = len;
+  XVECTOR (new)->header.size = len;
   return new;
 }
 
@@ -4916,7 +4914,7 @@ Does not copy symbols.  Copies strings w
       register int i;
       EMACS_INT size;
 
-      size = XVECTOR (obj)->size;
+      size = XVECTOR_SIZE (obj);
       if (size & PSEUDOVECTOR_FLAG)
 	size &= PSEUDOVECTOR_SIZE_MASK;
       vec = XVECTOR (make_pure_vector (size));
@@ -5038,7 +5036,7 @@ returns nil, because real GC can't be do
 	      }
 	  }
 
-	nextb = nextb->next;
+	nextb = nextb->header.next.buffer;
       }
   }
 
@@ -5184,7 +5182,7 @@ returns nil, because real GC can't be do
 	   undo_list any more, we can finally mark the list.  */
 	mark_object (nextb->undo_list);
 
-	nextb = nextb->next;
+	nextb = nextb->header.next.buffer;
       }
   }
 
@@ -5361,7 +5359,7 @@ static void
 mark_vectorlike (ptr)
      struct Lisp_Vector *ptr;
 {
-  register EMACS_INT size = ptr->size;
+  register EMACS_UINT size = ptr->header.size;
   register int i;
 
   eassert (!VECTOR_MARKED_P (ptr));
@@ -5385,7 +5383,7 @@ static void
 mark_char_table (ptr)
      struct Lisp_Vector *ptr;
 {
-  register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK;
+  register EMACS_UINT size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK;
   register int i;
 
   eassert (!VECTOR_MARKED_P (ptr));
@@ -5500,7 +5498,7 @@ mark_object (arg)
 	  if (po != &buffer_defaults && po != &buffer_local_symbols)
 	    {
 	      struct buffer *b;
-	      for (b = all_buffers; b && b != po; b = b->next)
+	      for (b = all_buffers; b && b != po; b = b->header.next)
 		;
 	      if (b == NULL)
 		abort ();
@@ -5516,7 +5514,7 @@ mark_object (arg)
 	   recursion there.  */
 	{
 	  register struct Lisp_Vector *ptr = XVECTOR (obj);
-	  register EMACS_INT size = ptr->size;
+	  register EMACS_UINT size = ptr->header.size;
 	  register int i;
 
 	  CHECK_LIVE (live_vector_p);
@@ -6150,10 +6148,10 @@ gc_sweep ()
       if (!VECTOR_MARKED_P (buffer))
 	{
 	  if (prev)
-	    prev->next = buffer->next;
+	    prev->header.next = buffer->header.next;
 	  else
-	    all_buffers = buffer->next;
-	  next = buffer->next;
+	    all_buffers = buffer->header.next.buffer;
+	  next = buffer->header.next.buffer;
 	  lisp_free (buffer);
 	  buffer = next;
 	}
@@ -6161,7 +6159,7 @@ gc_sweep ()
 	{
 	  VECTOR_UNMARK (buffer);
 	  UNMARK_BALANCE_INTERVALS (BUF_INTERVALS (buffer));
-	  prev = buffer, buffer = buffer->next;
+	  prev = buffer, buffer = buffer->header.next.buffer;
 	}
   }
 
@@ -6174,10 +6172,10 @@ gc_sweep ()
       if (!VECTOR_MARKED_P (vector))
 	{
 	  if (prev)
-	    prev->next = vector->next;
+	    prev->header.next = vector->header.next;
 	  else
-	    all_vectors = vector->next;
-	  next = vector->next;
+	    all_vectors = vector->header.next.vector;
+	  next = vector->header.next.vector;
 	  lisp_free (vector);
 	  n_vectors--;
 	  vector = next;
@@ -6186,11 +6184,11 @@ gc_sweep ()
       else
 	{
 	  VECTOR_UNMARK (vector);
-	  if (vector->size & PSEUDOVECTOR_FLAG)
-	    total_vector_size += (PSEUDOVECTOR_SIZE_MASK & vector->size);
+	  if (vector->header.size & PSEUDOVECTOR_FLAG)
+	    total_vector_size += PSEUDOVECTOR_SIZE_MASK & vector->header.size;
 	  else
-	    total_vector_size += vector->size;
-	  prev = vector, vector = vector->next;
+	    total_vector_size += vector->header.size;
+	  prev = vector, vector = vector->header.next.vector;
 	}
   }
 

=== modified file 'src/buffer.c'
--- src/buffer.c	2011-04-10 20:55:52 +0000
+++ src/buffer.c	2011-05-08 19:06:28 +0000
@@ -53,7 +53,7 @@ extern int errno;
 struct buffer *current_buffer;		/* the current buffer */
 
 /* First buffer in chain of all buffers (in reverse order of creation).
-   Threaded through ->next.  */
+   Threaded through ->header.next.  */
 
 struct buffer *all_buffers;
 
@@ -400,7 +400,7 @@ even if it is dead.  The return value is
   b->prevent_redisplay_optimizations_p = 1;
 
   /* Put this on the chain of all buffers including killed ones.  */
-  b->next = all_buffers;
+  b->header.next.buffer = all_buffers;
   all_buffers = b;
 
   /* An ordinary buffer normally doesn't need markers
@@ -633,7 +633,7 @@ CLONE nil means the indirect buffer's st
   b->width_table = Qnil;
 
   /* Put this on the chain of all buffers including killed ones.  */
-  b->next = all_buffers;
+  b->header.next.buffer = all_buffers;
   all_buffers = b;
 
   name = Fcopy_sequence (name);
@@ -1544,7 +1544,7 @@ with SIGHUP.  */)
 
       GCPRO1 (buffer);
 
-      for (other = all_buffers; other; other = other->next)
+      for (other = all_buffers; other; other = other->header.next.buffer)
 	/* all_buffers contains dead buffers too;
 	   don't re-kill them.  */
 	if (other->base_buffer == b && !NILP (other->name))
@@ -2214,7 +2214,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_
 
   { /* This is probably harder to make work.  */
     struct buffer *other;
-    for (other = all_buffers; other; other = other->next)
+    for (other = all_buffers; other; other = other->header.next.buffer)
       if (other->base_buffer == other_buffer
 	  || other->base_buffer == current_buffer)
 	error ("One of the buffers to swap has indirect buffers");
@@ -2585,7 +2585,7 @@ current buffer is cleared.  */)
 
   /* Copy this buffer's new multibyte status
      into all of its indirect buffers.  */
-  for (other = all_buffers; other; other = other->next)
+  for (other = all_buffers; other; other = other->header.next.buffer)
     if (other->base_buffer == current_buffer && !NILP (other->name))
       {
 	other->enable_multibyte_characters
@@ -4346,7 +4346,7 @@ static void
 add_overlay_mod_hooklist (functionlist, overlay)
      Lisp_Object functionlist, overlay;
 {
-  int oldsize = XVECTOR (last_overlay_modification_hooks)->size;
+  int oldsize = XVECTOR_SIZE (last_overlay_modification_hooks);
 
   if (last_overlay_modification_hooks_used == oldsize)
     last_overlay_modification_hooks = larger_vector 
@@ -5150,9 +5150,9 @@ init_buffer_once ()
   buffer_local_symbols.text = &buffer_local_symbols.own_text;
   BUF_INTERVALS (&buffer_defaults) = 0;
   BUF_INTERVALS (&buffer_local_symbols) = 0;
-  XSETPVECTYPE (&buffer_defaults, PVEC_BUFFER);
+  XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0);
   XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
-  XSETPVECTYPE (&buffer_local_symbols, PVEC_BUFFER);
+  XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0);
   XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
 
   /* Set up the default values of various buffer slots.  */

=== modified file 'src/buffer.h'
--- src/buffer.h	2011-03-19 16:42:53 +0000
+++ src/buffer.h	2011-05-08 18:32:58 +0000
@@ -487,14 +487,13 @@ struct buffer
 
      Check out mark_buffer (alloc.c) to see why.  */
 
-  EMACS_UINT size;
-
-  /* Next buffer, in chain of all buffers including killed buffers.
+  /* HEADER.NEXT is the next buffer, in chain of all buffers,
+     including killed buffers.
      This chain is used only for garbage collection, in order to
      collect killed buffers properly.
      Note that vectors and most pseudovectors are all on one chain,
      but buffers are on a separate chain of their own.  */
-  struct buffer *next;
+  struct vector_header header;
 
   /* This structure holds the coordinates of the buffer contents
      in ordinary buffers.  In indirect buffers, this is not used.  */

=== modified file 'src/bytecode.c'
--- src/bytecode.c	2011-01-02 23:50:46 +0000
+++ src/bytecode.c	2011-05-08 19:07:07 +0000
@@ -415,7 +415,7 @@ If the third argument is incorrect, Emac
   /* Lisp_Object v1, v2; */
   Lisp_Object *vectorp;
 #ifdef BYTE_CODE_SAFE
-  int const_length = XVECTOR (vector)->size;
+  int const_length;
   Lisp_Object *stacke;
 #endif
   int bytestr_length;
@@ -437,6 +437,7 @@ If the third argument is incorrect, Emac
   CHECK_VECTOR (vector);
   CHECK_NUMBER (maxdepth);
 
+  const_length = XVECTOR_SIZE (vector);
   if (STRING_MULTIBYTE (bytestr))
     /* BYTESTR must have been produced by Emacs 20.2 or the earlier
        because they produced a raw 8-bit string for byte-code and now

=== modified file 'src/callint.c'
--- src/callint.c	2011-01-02 23:50:46 +0000
+++ src/callint.c	2011-05-08 18:32:58 +0000
@@ -313,7 +313,7 @@ invoke it.  If KEYS is omitted or nil, t
   else
     {
       CHECK_VECTOR (keys);
-      key_count = XVECTOR (keys)->size;
+      key_count = XVECTOR_SIZE (keys);
     }
 
   /* Save this now, since use of minibuffer will clobber it. */

=== modified file 'src/ccl.c'
--- src/ccl.c	2011-01-02 23:50:46 +0000
+++ src/ccl.c	2011-05-08 18:32:58 +0000
@@ -1924,7 +1924,7 @@ setup_ccl_program (ccl, ccl_prog)
       if (! VECTORP (ccl_prog))
 	return -1;
       vp = XVECTOR (ccl_prog);
-      ccl->size = vp->size;
+      ccl->size = vp->header.size;
       ccl->prog = vp->contents;
       ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]);
       ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]);

=== modified file 'src/character.c'
--- src/character.c	2011-02-23 19:56:30 +0000
+++ src/character.c	2011-05-08 18:32:58 +0000
@@ -411,7 +411,7 @@ c_string_width (const unsigned char *str
 	{
 	  val = DISP_CHAR_VECTOR (dp, c);
 	  if (VECTORP (val))
-	    thiswidth = XVECTOR (val)->size;
+	    thiswidth = XVECTOR_SIZE (val);
 	  else
 	    thiswidth = CHAR_WIDTH (c);
 	}
@@ -503,7 +503,7 @@ lisp_string_width (string, precision, nc
 	    {
 	      val = DISP_CHAR_VECTOR (dp, c);
 	      if (VECTORP (val))
-		thiswidth = XVECTOR (val)->size;
+		thiswidth = XVECTOR_SIZE (val);
 	      else
 		thiswidth = CHAR_WIDTH (c);
 	    }

=== modified file 'src/chartab.c'
--- src/chartab.c	2011-01-02 23:50:46 +0000
+++ src/chartab.c	2011-05-08 18:32:58 +0000
@@ -152,7 +152,7 @@ copy_char_table (table)
      Lisp_Object table;
 {
   Lisp_Object copy;
-  int size = XCHAR_TABLE (table)->size & PSEUDOVECTOR_SIZE_MASK;
+  int size = XCHAR_TABLE (table)->header.size & PSEUDOVECTOR_SIZE_MASK;
   int i;
 
   copy = Fmake_vector (make_number (size), Qnil);

=== modified file 'src/coding.c'
--- src/coding.c	2011-01-02 23:50:46 +0000
+++ src/coding.c	2011-05-08 18:32:58 +0000
@@ -7339,7 +7339,7 @@ handle_composition_annotation (pos, limi
 	      components = COMPOSITION_COMPONENTS (prop);
 	      if (VECTORP (components))
 		{
-		  len = XVECTOR (components)->size;
+		  len = XVECTOR_SIZE (components);
 		  for (i = 0; i < len; i++)
 		    *buf++ = XINT (AREF (components, i));
 		}

=== modified file 'src/composite.c'
--- src/composite.c	2011-01-02 23:50:46 +0000
+++ src/composite.c	2011-05-08 19:07:29 +0000
@@ -300,7 +300,7 @@ get_composition_id (charpos, bytepos, nc
     }
   else if (VECTORP (components) || CONSP (components))
     {
-      int len = XVECTOR (key)->size;
+      EMACS_UINT len = XVECTOR_SIZE (key);
 
       /* The number of elements should be odd.  */
       if ((len % 2) == 0)
@@ -333,8 +333,8 @@ get_composition_id (charpos, bytepos, nc
 		    : COMPOSITION_WITH_RULE_ALTCHARS));
   cmp->hash_index = hash_index;
   glyph_len = (cmp->method == COMPOSITION_WITH_RULE_ALTCHARS
-	       ? (XVECTOR (key)->size + 1) / 2
-	       : XVECTOR (key)->size);
+	       ? (XVECTOR_SIZE (key) + 1) / 2
+	       : XVECTOR_SIZE (key));
   cmp->glyph_len = glyph_len;
   cmp->offsets = (short *) xmalloc (sizeof (short) * glyph_len * 2);
   cmp->font = NULL;

=== modified file 'src/data.c'
--- src/data.c	2011-01-02 23:50:46 +0000
+++ src/data.c	2011-05-08 19:08:54 +0000
@@ -1402,7 +1402,7 @@ for this variable.  */)
 	{
 	  struct buffer *b;
 
-	  for (b = all_buffers; b; b = b->next)
+	  for (b = all_buffers; b; b = b->header.next.buffer)
 	    if (!PER_BUFFER_VALUE_P (b, idx))
 	      PER_BUFFER_VALUE (b, offset) = value;
 	}
@@ -2029,9 +2029,9 @@ or a byte-code object.  IDX starts at 0.
     {
       int size = 0;
       if (VECTORP (array))
-	size = XVECTOR (array)->size;
+	size = XVECTOR_SIZE (array);
       else if (COMPILEDP (array))
-	size = XVECTOR (array)->size & PSEUDOVECTOR_SIZE_MASK;
+	size = XVECTOR_SIZE (array) & PSEUDOVECTOR_SIZE_MASK;
       else
 	wrong_type_argument (Qarrayp, array);
 
@@ -2058,7 +2058,7 @@ bool-vector.  IDX starts at 0.  */)
 
   if (VECTORP (array))
     {
-      if (idxval < 0 || idxval >= XVECTOR (array)->size)
+      if (idxval < 0 || idxval >= XVECTOR_SIZE (array))
 	args_out_of_range (array, idx);
       XVECTOR (array)->contents[idxval] = newelt;
     }

=== modified file 'src/dispnew.c'
--- src/dispnew.c	2011-01-02 23:50:46 +0000
+++ src/dispnew.c	2011-05-08 18:32:58 +0000
@@ -6729,7 +6729,7 @@ pass nil for VARIABLE.  */)
     state = frame_and_buffer_state;
 
   vecp = XVECTOR (state)->contents;
-  end = vecp + XVECTOR (state)->size;
+  end = vecp + XVECTOR_SIZE (state);
 
   FOR_EACH_FRAME (tail, frame)
     {
@@ -6780,8 +6780,8 @@ pass nil for VARIABLE.  */)
   /* Reallocate the vector if data has grown to need it,
      or if it has shrunk a lot.  */
   if (! VECTORP (state)
-      || n > XVECTOR (state)->size
-      || n + 20 < XVECTOR (state)->size / 2)
+      || n > XVECTOR_SIZE (state)
+      || n + 20 < XVECTOR_SIZE (state) / 2)
     /* Add 20 extra so we grow it less often.  */
     {
       state = Fmake_vector (make_number (n + 20), Qlambda);
@@ -6811,11 +6811,11 @@ pass nil for VARIABLE.  */)
   /* Fill up the vector with lambdas (always at least one).  */
   *vecp++ = Qlambda;
   while (vecp - XVECTOR (state)->contents
-	 < XVECTOR (state)->size)
+	 < XVECTOR_SIZE (state))
     *vecp++ = Qlambda;
   /* Make sure we didn't overflow the vector.  */
   if (vecp - XVECTOR (state)->contents
-      > XVECTOR (state)->size)
+      > XVECTOR_SIZE (state))
     abort ();
   return Qt;
 }

=== modified file 'src/disptab.h'
--- src/disptab.h	2011-01-02 23:50:46 +0000
+++ src/disptab.h	2011-05-08 19:09:19 +0000
@@ -62,7 +62,7 @@ extern Lisp_Object Vglyph_table;
 /* Return the current length of the GLYPH table,
    or 0 if the table isn't currently valid.  */
 #define GLYPH_TABLE_LENGTH  \
-  ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->size : 0)
+  ((VECTORP (Vglyph_table)) ? XVECTOR_SIZE (Vglyph_table) : 0)
 
 /* Return the current base (for indexing) of the GLYPH table,
    or 0 if the table isn't currently valid.  */

=== modified file 'src/doc.c'
--- src/doc.c	2011-01-02 23:50:46 +0000
+++ src/doc.c	2011-05-08 18:32:58 +0000
@@ -809,7 +809,7 @@ a new string, without any text propertie
 	do_remap:
 	  tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil);
 
-	  if (VECTORP (tem) && XVECTOR (tem)->size > 1
+	  if (VECTORP (tem) && XVECTOR_SIZE (tem) > 1
 	      && EQ (AREF (tem, 0), Qremap) && SYMBOLP (AREF (tem, 1))
 	      && follow_remap)
 	    {

=== modified file 'src/fns.c'
--- src/fns.c	2011-01-02 23:50:46 +0000
+++ src/fns.c	2011-05-08 19:10:58 +0000
@@ -4022,9 +4022,9 @@ copy_hash_table (h1)
   struct Lisp_Vector *next;
 
   h2 = allocate_hash_table ();
-  next = h2->vec_next;
+  next = h2->header.next.vector;
   bcopy (h1, h2, sizeof *h2);
-  h2->vec_next = next;
+  h2->header.next.vector = next;
   h2->key_and_value = Fcopy_sequence (h1->key_and_value);
   h2->hash = Fcopy_sequence (h1->hash);
   h2->next = Fcopy_sequence (h1->next);
@@ -4379,7 +4379,7 @@ sweep_weak_hash_tables ()
       marked = 0;
       for (h = weak_hash_tables; h; h = h->next_weak)
 	{
-	  if (h->size & ARRAY_MARK_FLAG)
+	  if (h->header.size & ARRAY_MARK_FLAG)
 	    marked |= sweep_weak_table (h, 0);
 	}
     }
@@ -4390,7 +4390,7 @@ sweep_weak_hash_tables ()
     {
       next = h->next_weak;
 
-      if (h->size & ARRAY_MARK_FLAG)
+      if (h->header.size & ARRAY_MARK_FLAG)
 	{
 	  /* TABLE is marked as used.  Sweep its contents.  */
 	  if (h->count > 0)
@@ -4513,7 +4513,7 @@ sxhash_bool_vector (vec)
   unsigned hash = XBOOL_VECTOR (vec)->size;
   int i, n;
 
-  n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->vector_size);
+  n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->header.size);
   for (i = 0; i < n; ++i)
     hash = SXHASH_COMBINE (hash, XBOOL_VECTOR (vec)->data[i]);
 

=== modified file 'src/font.c'
--- src/font.c	2011-02-23 01:56:49 +0000
+++ src/font.c	2011-05-08 18:32:58 +0000
@@ -269,7 +269,7 @@ font_intern_prop (str, len, force_symbol
   /* The following code is copied from the function intern (in
      lread.c), and modified to suite our purpose.  */
   obarray = Vobarray;
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     obarray = check_obarray (obarray);
   parse_str_as_multibyte ((unsigned char *) str, len, &nchars, &nbytes);
   if (len == nchars || len != nbytes)

=== modified file 'src/font.h'
--- src/font.h	2011-01-02 23:50:46 +0000
+++ src/font.h	2011-05-08 18:32:58 +0000
@@ -247,8 +247,7 @@ extern Lisp_Object Qja, Qko;
 
 struct font_spec
 {
-  EMACS_UINT size;
-  struct Lisp_Vector *next;
+  struct vector_header header;
   Lisp_Object props[FONT_SPEC_MAX];
 };
 
@@ -256,8 +255,7 @@ struct font_spec
 
 struct font_entity
 {
-  EMACS_UINT size;
-  struct Lisp_Vector *next;
+  struct vector_header header;
   Lisp_Object props[FONT_ENTITY_MAX];
 };
 
@@ -270,8 +268,7 @@ struct font_entity
 
 struct font
 {
-  EMACS_UINT size;
-  struct Lisp_Vector *next;
+  struct vector_header header;
 
   /* All Lisp_Object components must come first.
      That ensures they are all aligned normally.  */

=== modified file 'src/frame.h'
--- src/frame.h	2011-01-02 23:50:46 +0000
+++ src/frame.h	2011-05-08 18:32:58 +0000
@@ -93,8 +93,7 @@ struct font_driver_list;
 
 struct frame
 {
-  EMACS_UINT size;
-  struct Lisp_Vector *next;
+  struct vector_header header;
 
   /* All Lisp_Object components must come first.
      That ensures they are all aligned normally.  */

=== modified file 'src/fringe.c'
--- src/fringe.c	2011-03-11 03:56:20 +0000
+++ src/fringe.c	2011-05-08 18:32:58 +0000
@@ -1569,7 +1569,7 @@ If BITMAP already exists, the existing d
   if (STRINGP (bits))
     h = SCHARS (bits);
   else if (VECTORP (bits))
-    h = XVECTOR (bits)->size;
+    h = XVECTOR_SIZE (bits);
   else
     wrong_type_argument (Qsequencep, bits);
 

=== modified file 'src/image.c'
--- src/image.c	2011-01-29 23:56:33 +0000
+++ src/image.c	2011-05-08 18:32:58 +0000
@@ -2459,7 +2459,7 @@ xbm_image_p (object)
 	  int i;
 
 	  /* Number of elements of the vector must be >= height.  */
-	  if (XVECTOR (data)->size < height)
+	  if (XVECTOR_SIZE (data) < height)
 	    return 0;
 
 	  /* Each string or bool-vector in data must be large enough
@@ -8083,7 +8083,7 @@ gs_image_p (object)
     }
   else if (VECTORP (tem))
     {
-      if (XVECTOR (tem)->size != 4)
+      if (XVECTOR_SIZE (tem) != 4)
 	return 0;
       for (i = 0; i < 4; ++i)
 	if (!INTEGERP (XVECTOR (tem)->contents[i]))

=== modified file 'src/indent.c'
--- src/indent.c	2011-01-02 23:50:46 +0000
+++ src/indent.c	2011-05-08 19:11:57 +0000
@@ -101,7 +101,7 @@ character_width (c, dp)
   /* Everything can be handled by the display table, if it's
      present and the element is right.  */
   if (dp && (elt = DISP_CHAR_VECTOR (dp, c), VECTORP (elt)))
-    return XVECTOR (elt)->size;
+    return XVECTOR_SIZE (elt);
 
   /* Some characters are special.  */
   if (c == '\n' || c == '\t' || c == '\015')
@@ -131,7 +131,7 @@ disptab_matches_widthtab (disptab, width
 {
   int i;
 
-  if (widthtab->size != 256)
+  if (widthtab->header.size != 256)
     abort ();
 
   for (i = 0; i < 256; i++)
@@ -155,7 +155,7 @@ recompute_width_table (buf, disptab)
   if (!VECTORP (buf->width_table))
     buf->width_table = Fmake_vector (make_number (256), make_number (0));
   widthtab = XVECTOR (buf->width_table);
-  if (widthtab->size != 256)
+  if (widthtab->header.size != 256)
     abort ();
 
   for (i = 0; i < 256; i++)
@@ -301,7 +301,7 @@ skip_invisible (pos, next_boundary_p, to
     else								\
       {									\
 	if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))		\
-	  width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size;		\
+	  width = XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, ch));		\
 	else								\
 	  width = CHAR_WIDTH (c);					\
 	if (width > 1)							\
@@ -786,7 +786,7 @@ string_display_width (string, beg, end)
 
       c = *--ptr;
       if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
-	col += XVECTOR (DISP_CHAR_VECTOR (dp, c))->size;
+	col += XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, c));
       else if (c >= 040 && c < 0177)
 	col++;
       else if (c == '\n')
@@ -1159,7 +1159,7 @@ compute_motion (from, fromvpos, fromhpos
        : !NILP (current_buffer->selective_display) ? -1 : 0);
   int selective_rlen
     = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
-       ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0);
+       ? XVECTOR_SIZE (DISP_INVIS_VECTOR (dp)) : 0);
   /* The next location where the `invisible' property changes, or an
      overlay starts or ends.  */
   EMACS_INT next_boundary = from;

=== modified file 'src/keyboard.c'
--- src/keyboard.c	2011-01-02 23:50:46 +0000
+++ src/keyboard.c	2011-05-08 19:14:40 +0000
@@ -137,7 +137,7 @@ int raw_keybuf_count;
 Lisp_Object Vthis_command_keys_shift_translated;
 
 #define GROW_RAW_KEYBUF							\
- if (raw_keybuf_count == XVECTOR (raw_keybuf)->size)			\
+ if (raw_keybuf_count == XVECTOR_SIZE (raw_keybuf))			\
    raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil)  \
 
 /* Number of elements of this_command_keys
@@ -3203,7 +3203,7 @@ read_char (commandflag, nmaps, maps, pre
       if ((STRINGP (current_kboard->Vkeyboard_translate_table)
 	   && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c))
 	  || (VECTORP (current_kboard->Vkeyboard_translate_table)
-	      && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c))
+	      && XVECTOR_SIZE (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c))
 	  || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table)
 	      && CHARACTERP (c)))
 	{
@@ -4552,7 +4552,7 @@ timer_start_idle ()
 
       timer = XCAR (timers);
 
-      if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+      if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
 	continue;
       XVECTOR (timer)->contents[0] = Qnil;
     }
@@ -4646,7 +4646,7 @@ timer_check_2 ()
       if (!NILP (timers))
 	{
 	  timer = XCAR (timers);
-	  if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+	  if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
 	    {
 	      timers = XCDR (timers);
 	      continue;
@@ -4664,7 +4664,7 @@ timer_check_2 ()
       if (!NILP (idle_timers))
 	{
 	  timer = XCAR (idle_timers);
-	  if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+	  if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
 	    {
 	      idle_timers = XCDR (idle_timers);
 	      continue;
@@ -5830,7 +5830,7 @@ make_lispy_event (event)
 		/* Find the menu bar item under `column'.  */
 		item = Qnil;
 		items = FRAME_MENU_BAR_ITEMS (f);
-		for (i = 0; i < XVECTOR (items)->size; i += 4)
+		for (i = 0; i < XVECTOR_SIZE (items); i += 4)
 		  {
 		    Lisp_Object pos, string;
 		    string = AREF (items, i + 1);
@@ -6025,7 +6025,7 @@ make_lispy_event (event)
 				      Qmouse_click, Vlispy_mouse_stem,
 				      NULL,
 				      &mouse_syms,
-				      XVECTOR (mouse_syms)->size);
+				      XVECTOR_SIZE (mouse_syms));
 	  if (event->modifiers & drag_modifier)
 	    return Fcons (head,
 			  Fcons (start_pos,
@@ -6198,7 +6198,7 @@ make_lispy_event (event)
 				    Qmouse_click,
 				    Vlispy_mouse_stem,
 				    NULL, &mouse_syms,
-				    XVECTOR (mouse_syms)->size);
+				    XVECTOR_SIZE (mouse_syms));
 	return Fcons (head, Fcons (position, Qnil));
       }
 
@@ -6318,7 +6318,7 @@ make_lispy_event (event)
 				    Qmouse_click, Vlispy_mouse_stem,
 				    NULL,
 				    &mouse_syms,
-				    XVECTOR (mouse_syms)->size);
+				    XVECTOR_SIZE (mouse_syms));
 
 	if (event->modifiers & drag_modifier)
 	  return Fcons (head,
@@ -6825,7 +6825,7 @@ modify_event_symbol (symbol_num, modifie
   else
     {
       if (! VECTORP (*symbol_table)
-	  || XVECTOR (*symbol_table)->size != table_size)
+	  || XVECTOR_SIZE (*symbol_table) != table_size)
 	{
 	  Lisp_Object size;
 
@@ -7865,7 +7865,7 @@ menu_bar_items (old)
 
   /* Add nil, nil, nil, nil at the end.  */
   i = menu_bar_items_index;
-  if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
+  if (i + 4 > XVECTOR_SIZE (menu_bar_items_vector))
     menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
   /* Add this item.  */
   XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
@@ -7937,7 +7937,7 @@ menu_bar_item (key, item, dummy1, dummy2
   if (i == menu_bar_items_index)
     {
       /* If vector is too small, get a bigger one.  */
-      if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
+      if (i + 4 > XVECTOR_SIZE (menu_bar_items_vector))
 	menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
       /* Add this item.  */
       XVECTOR (menu_bar_items_vector)->contents[i++] = key;
@@ -8573,7 +8573,7 @@ parse_tool_bar_item (key, item)
 	}
       else if (EQ (key, QCimage)
 	       && (CONSP (value)
-		   || (VECTORP (value) && XVECTOR (value)->size == 4)))
+		   || (VECTORP (value) && XVECTOR_SIZE (value) == 4)))
 	/* Value is either a single image specification or a vector
 	   of 4 such specifications for the different button states.  */
 	PROP (TOOL_BAR_ITEM_IMAGES) = value;
@@ -8634,10 +8634,10 @@ append_tool_bar_item ()
 
   /* Enlarge tool_bar_items_vector if necessary.  */
   if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS
-      >= XVECTOR (tool_bar_items_vector)->size)
+      >= XVECTOR_SIZE (tool_bar_items_vector))
     tool_bar_items_vector
       = larger_vector (tool_bar_items_vector,
-		       2 * XVECTOR (tool_bar_items_vector)->size, Qnil);
+		       2 * XVECTOR_SIZE (tool_bar_items_vector), Qnil);
 
   /* Append entries from tool_bar_item_properties to the end of
      tool_bar_items_vector.  */
@@ -8966,7 +8966,7 @@ read_char_minibuf_menu_prompt (commandfl
 		}
 
 	      /* Move past this element.  */
-	      if (idx >= 0 && idx + 1 >= XVECTOR (vector)->size)
+	      if (idx >= 0 && idx + 1 >= XVECTOR_SIZE (vector))
 		/* Handle reaching end of dense table.  */
 		idx = -1;
 	      if (idx >= 0)
@@ -10244,7 +10244,7 @@ read_key_sequence (keybuf, bufsize, prom
 	      /* Treat uppercase keys as shifted.  */
 	      || (INTEGERP (key)
 		  && (KEY_TO_CHAR (key)
-		      < XCHAR_TABLE (current_buffer->downcase_table)->size)
+		      < XCHAR_TABLE (current_buffer->downcase_table)->header.size)
 		  && UPPERCASEP (KEY_TO_CHAR (key))))
 	    {
 	      Lisp_Object new_key
@@ -10642,7 +10642,7 @@ give to the command you invoke, if it as
     this_single_command_key_start = 0;
 
     keys = XVECTOR (saved_keys)->contents;
-    for (i = 0; i < XVECTOR (saved_keys)->size; i++)
+    for (i = 0; i < XVECTOR_SIZE (saved_keys); i++)
       add_command_key (keys[i]);
 
     for (i = 0; i < SCHARS (function); i++)
@@ -10939,7 +10939,7 @@ KEEP-RECORD is non-nil.  */)
 
   if (NILP (keep_record))
     {
-      for (i = 0; i < XVECTOR (recent_keys)->size; ++i)
+      for (i = 0; i < XVECTOR_SIZE (recent_keys); ++i)
 	XVECTOR (recent_keys)->contents[i] = Qnil;
       total_keys = 0;
       recent_keys_index = 0;

=== modified file 'src/keymap.c'
--- src/keymap.c	2011-02-23 04:26:42 +0000
+++ src/keymap.c	2011-05-08 19:15:23 +0000
@@ -421,7 +421,7 @@ Return PARENT.  PARENT should be nil or 
 				XCDR (XCAR (list)));
 
       if (VECTORP (XCAR (list)))
-	for (i = 0; i < XVECTOR (XCAR (list))->size; i++)
+	for (i = 0; i < XVECTOR_SIZE (XCAR (list)); i++)
 	  if (CONSP (XVECTOR (XCAR (list))->contents[i]))
 	    fix_submap_inheritance (keymap, make_number (i),
 				    XVECTOR (XCAR (list))->contents[i]);
@@ -2337,7 +2337,7 @@ spaces are put between sequence elements
   if (STRINGP (list))
     size = SCHARS (list);
   else if (VECTORP (list))
-    size = XVECTOR (list)->size;
+    size = XVECTOR_SIZE (list);
   else if (CONSP (list))
     size = XINT (Flength (list));
   else
@@ -3257,7 +3257,7 @@ key             binding\n\
 
 	  elt = XCAR (list);
 	  prefix = Fcar (elt);
-	  if (XVECTOR (prefix)->size >= 1)
+	  if (XVECTOR_SIZE (elt_prefix) >= 1)
 	    {
 	      tem = Faref (prefix, make_number (0));
 	      if (EQ (tem, Qmenu_bar))
@@ -3300,7 +3300,7 @@ key             binding\n\
 	  /* If the sequence by which we reach this keymap is zero-length,
 	     then the shadow map for this keymap is just SHADOW.  */
 	  if ((STRINGP (prefix) && SCHARS (prefix) == 0)
-	      || (VECTORP (prefix) && XVECTOR (prefix)->size == 0))
+	      || (VECTORP (elt_prefix) && XVECTOR_SIZE (elt_prefix) == 0))
 	    ;
 	  /* If the sequence by which we reach this keymap actually has
 	     some elements, then the sequence's definition in SHADOW is
@@ -3748,7 +3748,7 @@ describe_vector (vector, prefix, args, e
   if (CHAR_TABLE_P (vector))
     stop = MAX_5_BYTE_CHAR + 1, to = MAX_CHAR + 1;
   else
-    stop = to = XVECTOR (vector)->size;
+    stop = to = XVECTOR_SIZE (vector);
 
   for (i = from; ; i++)
     {

=== modified file 'src/lisp.h'
--- src/lisp.h	2011-01-23 22:38:13 +0000
+++ src/lisp.h	2011-05-08 19:16:10 +0000
@@ -550,6 +550,11 @@ extern Lisp_Object make_number P_ ((EMAC
 #define XSYMBOL(a) (eassert (SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a))
 #define XFLOAT(a) (eassert (FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
 
+/* Extract the size field of a vector or vector-like object.  */
+
+#define XVECTOR_SIZE(a) (XVECTOR (a)->header.size + 0)
+#define XVECTOR_HEADER_SIZE(a) (((struct vector_header *) XPNTR (a))->size + 0)
+
 /* Misc types.  */
 
 #define XMISC(a)   ((union Lisp_Misc *) XPNTR(a))
@@ -595,17 +600,24 @@ extern Lisp_Object make_number P_ ((EMAC
 
 /* Pseudovector types.  */
 
-#define XSETPVECTYPE(v,code) ((v)->size |= PSEUDOVECTOR_FLAG | (code))
+#define XSETPVECTYPE(v, code) XSETTYPED_PVECTYPE(v, header.size, code)
+#define XSETTYPED_PVECTYPE(v, size_member, code) \
+  ((v)->size_member |= PSEUDOVECTOR_FLAG | (code))
+#define XSETPVECTYPESIZE(v, code, sizeval) \
+  ((v)->header.size = PSEUDOVECTOR_FLAG | (code) | (sizeval))
 #define XSETPSEUDOVECTOR(a, b, code) \
+  XSETTYPED_PSEUDOVECTOR(a, b, XVECTOR_HEADER_SIZE (a), code)
+#define XSETTYPED_PSEUDOVECTOR(a, b, size, code)			\
   (XSETVECTOR (a, b),							\
-   eassert ((XVECTOR (a)->size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK))	\
+   eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK))		\
 	    == (PSEUDOVECTOR_FLAG | (code))))
 #define XSETWINDOW_CONFIGURATION(a, b) \
   (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
 #define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
 #define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
 #define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL))
-#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
+#define XSETSUBR(a, b) \
+  XSETTYPED_PSEUDOVECTOR (a, b, XSUBR (a)->size, PVEC_SUBR)
 #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
 #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
 #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
@@ -615,7 +627,7 @@ extern Lisp_Object make_number P_ ((EMAC
 /* Convenience macros for dealing with Lisp arrays.  */
 
 #define AREF(ARRAY, IDX)	XVECTOR ((ARRAY))->contents[IDX]
-#define ASIZE(ARRAY)		XVECTOR ((ARRAY))->size
+#define ASIZE(ARRAY)		XVECTOR_SIZE (ARRAY)
 /* The IDX==IDX tries to detect when the macro argument is side-effecting.  */
 #define ASET(ARRAY, IDX, VAL)	\
   (eassert ((IDX) == (IDX)),				\
@@ -780,11 +792,21 @@ struct Lisp_String
 #define OFFSETOF(type,field) \
   ((int)((char*)&((type*)0)->field - (char*)0))
 #endif
+/* Header of vector-like objects.  This type documents the constraints on
+   layout of vectors and pseudovectors, and helps optimizing compilers not get
+   fooled by Emacs's type punning.  */
+struct vector_header
+  {
+    EMACS_UINT size;
+    union {
+      struct buffer *buffer;
+      struct Lisp_Vector *vector;
+    } next;
+  };
 
 struct Lisp_Vector
   {
-    EMACS_UINT size;
-    struct Lisp_Vector *next;
+    struct vector_header header;
     Lisp_Object contents[1];
   };
 
@@ -820,7 +842,7 @@ struct Lisp_Vector
 /* Return the number of "extra" slots in the char table CT.  */
 
 #define CHAR_TABLE_EXTRA_SLOTS(CT)	\
-  (((CT)->size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
+  (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
 
 #ifdef __GNUC__
 
@@ -882,12 +904,11 @@ struct Lisp_Sub_Char_Table;
 
 struct Lisp_Char_Table
   {
-    /* This is the vector's size field, which also holds the
+    /* HEADER.SIZE is the vector's size field, which also holds the
        pseudovector type information.  It holds the size, too.
        The size counts the defalt, parent, purpose, ascii,
        contents, and extras slots.  */
-    EMACS_UINT size;
-    struct Lisp_Vector *next;
+    struct vector_header header;
 
     /* This holds a default value,
        which is used whenever the value for a specific character is nil.  */
@@ -914,10 +935,9 @@ struct Lisp_Char_Table
 
 struct Lisp_Sub_Char_Table
   {
-    /* This is the vector's size field, which also holds the
+    /* HEADER.SIZE is the vector's size field, which also holds the
        pseudovector type information.  It holds the size, too.  */
-    EMACS_INT size;
-    struct Lisp_Vector *next;
+    struct vector_header header;
 
     /* Depth of this sub char-table.  It should be 1, 2, or 3.  A sub
        char-table of depth 1 contains 16 elements, and each element
@@ -936,10 +956,9 @@ struct Lisp_Sub_Char_Table
 /* A boolvector is a kind of vectorlike, with contents are like a string.  */
 struct Lisp_Bool_Vector
   {
-    /* This is the vector's size field.  It doesn't have the real size,
+    /* HEADER.SIZE is the vector's size field.  It doesn't have the real size,
        just the subtype information.  */
-    EMACS_UINT vector_size;
-    struct Lisp_Vector *next;
+    struct vector_header header;
     /* This is the size in bits.  */
     EMACS_UINT size;
     /* This contains the actual bits, packed into bytes.  */
@@ -952,7 +971,7 @@ struct Lisp_Bool_Vector
 
    This type is treated in most respects as a pseudovector,
    but since we never dynamically allocate or free them,
-   we don't need a next-vector field.  */
+   we don't need a struct vector_header and its 'next' field.  */
 
 struct Lisp_Subr
   {
@@ -1066,9 +1085,8 @@ struct Lisp_Symbol
 
 struct Lisp_Hash_Table
 {
-  /* Vector fields.  The hash table code doesn't refer to these.  */
-  EMACS_UINT size;
-  struct Lisp_Vector *vec_next;
+  /* This is for Lisp; the hash table code does not refer to it.  */
+  struct vector_header header;
 
   /* Function used to compare keys.  */
   Lisp_Object test;
@@ -1169,7 +1187,7 @@ struct Lisp_Hash_Table
 
 /* Value is the size of hash table H.  */
 
-#define HASH_TABLE_SIZE(H) XVECTOR ((H)->next)->size
+#define HASH_TABLE_SIZE(H) XVECTOR_SIZE ((H)->next)
 
 /* Default size for hash tables if not specified.  */
 
@@ -1551,7 +1569,7 @@ typedef struct {
 #define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
 
 #define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
-#define VECTORP(x)    (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
+#define VECTORP(x)    (VECTORLIKEP (x) && !(XVECTOR_SIZE (x) & PSEUDOVECTOR_FLAG))
 #define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
 #define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
 #define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
@@ -1566,8 +1584,14 @@ typedef struct {
 
 /* True if object X is a pseudovector whose code is CODE.  */
 #define PSEUDOVECTORP(x, code)					\
+  TYPED_PSEUDOVECTORP(x, vector_header, code)
+
+/* True if object X, with internal type struct T *, is a pseudovector whose
+   code is CODE.  */
+#define TYPED_PSEUDOVECTORP(x, t, code)				\
   (VECTORLIKEP (x)						\
-   && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code))))	\
+   && (((((struct t *) XPNTR (x))->size				\
+	 & (PSEUDOVECTOR_FLAG | (code))))			\
        == (PSEUDOVECTOR_FLAG | (code))))
 
 /* Test for specific pseudovector types.  */
@@ -1575,7 +1599,7 @@ typedef struct {
 #define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS)
 #define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
 #define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL)
-#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR)
+#define SUBRP(x) TYPED_PSEUDOVECTORP (x, Lisp_Subr, PVEC_SUBR)
 #define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
 #define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
 #define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE)

=== modified file 'src/lread.c'
--- src/lread.c	2011-03-19 16:42:53 +0000
+++ src/lread.c	2011-05-08 18:32:58 +0000
@@ -2433,7 +2433,7 @@ read1 (readcharfun, pch, first_in_list)
 	    {
 	      Lisp_Object tmp;
 	      tmp = read_vector (readcharfun, 0);
-	      if (XVECTOR (tmp)->size < CHAR_TABLE_STANDARD_SLOTS)
+	      if (XVECTOR_SIZE (tmp) < CHAR_TABLE_STANDARD_SLOTS)
 		error ("Invalid size char-table");
 	      XSETPVECTYPE (XVECTOR (tmp), PVEC_CHAR_TABLE);
 	      return tmp;
@@ -2452,7 +2452,7 @@ read1 (readcharfun, pch, first_in_list)
 		  depth = XINT (AREF (tmp, 0));
 		  if (depth < 1 || depth > 3)
 		    error ("Invalid depth in char-table");
-		  size = XVECTOR (tmp)->size - 2;
+		  size = XVECTOR_SIZE (tmp) - 2;
 		  if (chartab_size [depth] != size)
 		    error ("Invalid size char-table");
 		  XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE);
@@ -2503,7 +2503,7 @@ read1 (readcharfun, pch, first_in_list)
 	     build them using function calls.  */
 	  Lisp_Object tmp;
 	  tmp = read_vector (readcharfun, 1);
-	  return Fmake_byte_code (XVECTOR (tmp)->size,
+	  return Fmake_byte_code (XVECTOR_SIZE (tmp),
 				  XVECTOR (tmp)->contents);
 	}
       if (c == '(')
@@ -3332,7 +3332,7 @@ read_vector (readcharfun, bytecodeflag)
   len = Flength (tem);
   vector = (read_pure ? make_pure_vector (XINT (len)) : Fmake_vector (len, Qnil));
 
-  size = XVECTOR (vector)->size;
+  size = XVECTOR_SIZE (vector);
   ptr = XVECTOR (vector)->contents;
   for (i = 0; i < size; i++)
     {
@@ -3601,7 +3601,7 @@ Lisp_Object
 check_obarray (obarray)
      Lisp_Object obarray;
 {
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     {
       /* If Vobarray is now invalid, force it to be valid.  */
       if (EQ (Vobarray, obarray)) Vobarray = initial_obarray;
@@ -3622,7 +3622,7 @@ intern (str)
   Lisp_Object obarray;
 
   obarray = Vobarray;
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     obarray = check_obarray (obarray);
   tem = oblookup (obarray, str, len, len);
   if (SYMBOLP (tem))
@@ -3638,7 +3638,7 @@ intern_c_string (const char *str)
   Lisp_Object obarray;
 
   obarray = Vobarray;
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     obarray = check_obarray (obarray);
   tem = oblookup (obarray, str, len, len);
   if (SYMBOLP (tem))
@@ -3831,10 +3831,10 @@ oblookup (obarray, ptr, size, size_byte)
   Lisp_Object bucket, tem;
 
   if (!VECTORP (obarray)
-      || (obsize = XVECTOR (obarray)->size) == 0)
+      || (obsize = XVECTOR_SIZE (obarray)) == 0)
     {
       obarray = check_obarray (obarray);
-      obsize = XVECTOR (obarray)->size;
+      obsize = XVECTOR_SIZE (obarray);
     }
   /* This is sometimes needed in the middle of GC.  */
   obsize &= ~ARRAY_MARK_FLAG;
@@ -3887,7 +3887,7 @@ map_obarray (obarray, fn, arg)
   register int i;
   register Lisp_Object tail;
   CHECK_VECTOR (obarray);
-  for (i = XVECTOR (obarray)->size - 1; i >= 0; i--)
+  for (i = XVECTOR_SIZE (obarray) - 1; i >= 0; i--)
     {
       tail = XVECTOR (obarray)->contents[i];
       if (SYMBOLP (tail))
@@ -3974,7 +3974,7 @@ defsubr (sname)
 {
   Lisp_Object sym;
   sym = intern_c_string (sname->symbol_name);
-  XSETPVECTYPE (sname, PVEC_SUBR);
+  XSETTYPED_PVECTYPE (sname, size, PVEC_SUBR);
   XSETSUBR (XSYMBOL (sym)->function, sname);
 }
 

=== modified file 'src/minibuf.c'
--- src/minibuf.c	2011-01-02 23:50:46 +0000
+++ src/minibuf.c	2011-05-08 19:17:07 +0000
@@ -1326,7 +1326,7 @@ is used to further constrain the set of 
   if (type == obarray_table)
     {
       collection = check_obarray (collection);
-      obsize = XVECTOR (collection)->size;
+      obsize = XVECTOR_SIZE (collection);
       bucket = XVECTOR (collection)->contents[index];
     }
 
@@ -1590,7 +1590,7 @@ with a space are ignored unless STRING i
   if (type == 2)
     {
       collection = check_obarray (collection);
-      obsize = XVECTOR (collection)->size;
+      obsize = XVECTOR_SIZE (collection);
       bucket = XVECTOR (collection)->contents[index];
     }
 
@@ -1889,7 +1889,7 @@ the values STRING, PREDICATE and `lambda
 
       if (completion_ignore_case && !SYMBOLP (tem))
 	{
-	  for (i = XVECTOR (collection)->size - 1; i >= 0; i--)
+	  for (i = XVECTOR_SIZE (collection) - 1; i >= 0; i--)
 	    {
 	      tail = XVECTOR (collection)->contents[i];
 	      if (SYMBOLP (tail))

=== modified file 'src/print.c'
--- src/print.c	2011-01-02 23:50:46 +0000
+++ src/print.c	2011-05-08 19:18:19 +0000
@@ -1411,7 +1411,7 @@ print_preprocess (obj)
 	  goto loop;
 
 	case Lisp_Vectorlike:
-	  size = XVECTOR (obj)->size;
+	  size = XVECTOR_SIZE (obj);
 	  if (size & PSEUDOVECTOR_FLAG)
 	    size &= PSEUDOVECTOR_SIZE_MASK;
 	  for (i = 0; i < size; i++)
@@ -2051,7 +2051,7 @@ print_object (obj, printcharfun, escapef
 	      strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0);
 	      PRINTCHAR (' ');
 	      sprintf (buf, "%ld/%ld", (long) h->count,
-		       (long) XVECTOR (h->next)->size);
+		       (long) XVECTOR_SIZE (h->next));
 	      strout (buf, -1, -1, printcharfun, 0);
 	    }
 	  sprintf (buf, " 0x%lx", (unsigned long) h);
@@ -2062,7 +2062,7 @@ print_object (obj, printcharfun, escapef
 	    #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
 	  /* Always print the size. */
 	  sprintf (buf, "#s(hash-table size %ld",
-		   (long) XVECTOR (h->next)->size);
+		   (long) XVECTOR_SIZE (h->next));
 	  strout (buf, -1, -1, printcharfun, 0);
 
 	  if (!NILP (h->test))
@@ -2174,7 +2174,7 @@ print_object (obj, printcharfun, escapef
 	}
       else
 	{
-	  EMACS_INT size = XVECTOR (obj)->size;
+	  EMACS_INT size = XVECTOR_SIZE (obj);
 	  if (COMPILEDP (obj))
 	    {
 	      PRINTCHAR ('#');
@@ -2354,7 +2354,7 @@ print_object (obj, printcharfun, escapef
 	if (MISCP (obj))
 	  sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
 	else if (VECTORLIKEP (obj))
-	  sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size);
+	  sprintf (buf, "(PVEC 0x%08lx)", (unsigned long) XVECTOR_SIZE (obj));
 	else
 	  sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
 	strout (buf, -1, -1, printcharfun, 0);

=== modified file 'src/process.c'
--- src/process.c	2011-03-19 18:47:17 +0000
+++ src/process.c	2011-05-08 18:32:58 +0000
@@ -1277,25 +1277,26 @@ Returns nil if format of ADDRESS is inva
   if (VECTORP (address))  /* AF_INET or AF_INET6 */
     {
       register struct Lisp_Vector *p = XVECTOR (address);
+      EMACS_UINT size = p->header.size;
       Lisp_Object args[10];
       int nargs, i;
 
-      if (p->size == 4 || (p->size == 5 && !NILP (omit_port)))
+      if (size == 4 || (size == 5 && !NILP (omit_port)))
 	{
 	  args[0] = build_string ("%d.%d.%d.%d");
 	  nargs = 4;
 	}
-      else if (p->size == 5)
+      else if (size == 5)
 	{
 	  args[0] = build_string ("%d.%d.%d.%d:%d");
 	  nargs = 5;
 	}
-      else if (p->size == 8 || (p->size == 9 && !NILP (omit_port)))
+      else if (size == 8 || (size == 9 && !NILP (omit_port)))
 	{
 	  args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
 	  nargs = 8;
 	}
-      else if (p->size == 9)
+      else if (size == 9)
 	{
 	  args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
 	  nargs = 9;
@@ -2477,13 +2478,13 @@ get_lisp_to_sockaddr_size (address, fami
   if (VECTORP (address))
     {
       p = XVECTOR (address);
-      if (p->size == 5)
+      if (p->header.size == 5)
 	{
 	  *familyp = AF_INET;
 	  return sizeof (struct sockaddr_in);
 	}
 #ifdef AF_INET6
-      else if (p->size == 9)
+      else if (p->header.size == 9)
 	{
 	  *familyp = AF_INET6;
 	  return sizeof (struct sockaddr_in6);
@@ -2502,7 +2503,7 @@ get_lisp_to_sockaddr_size (address, fami
       struct sockaddr *sa;
       *familyp = XINT (XCAR (address));
       p = XVECTOR (XCDR (address));
-      return p->size + sizeof (sa->sa_family);
+      return p->header.size + sizeof (sa->sa_family);
     }
   return 0;
 }

=== modified file 'src/process.h'
--- src/process.h	2011-01-02 23:50:46 +0000
+++ src/process.h	2011-05-08 18:32:58 +0000
@@ -27,13 +27,13 @@ along with GNU Emacs.  If not, see <http
 /* This structure records information about a subprocess
    or network connection.
 
-   Every field in this structure except for the first two
+   Every field in this structure except for the header
    must be a Lisp_Object, for GC's sake.  */
 
 struct Lisp_Process
   {
-    EMACS_UINT size;
-    struct Lisp_Vector *v_next;
+    struct vector_header header;
+
     /* Name of subprocess terminal.  */
     Lisp_Object tty_name;
     /* Name of this process */

=== modified file 'src/syntax.c'
--- src/syntax.c	2011-01-02 23:50:46 +0000
+++ src/syntax.c	2011-05-08 18:32:58 +0000
@@ -956,7 +956,7 @@ text property.  */)
 	break;
       }
 
-  if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match))
+  if (val < XVECTOR_SIZE (Vsyntax_code_object) && NILP (match))
     return XVECTOR (Vsyntax_code_object)->contents[val];
   else
     /* Since we can't use a shared object, let's make a new one.  */
@@ -3348,7 +3348,7 @@ init_syntax_once ()
 
   /* Create objects which can be shared among syntax tables.  */
   Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil);
-  for (i = 0; i < XVECTOR (Vsyntax_code_object)->size; i++)
+  for (i = 0; i < XVECTOR_SIZE (Vsyntax_code_object); i++)
     XVECTOR (Vsyntax_code_object)->contents[i]
       = Fcons (make_number (i), Qnil);
 

=== modified file 'src/termhooks.h'
--- src/termhooks.h	2011-01-02 23:50:46 +0000
+++ src/termhooks.h	2011-05-08 18:32:58 +0000
@@ -325,10 +325,8 @@ struct w32_display_info;
 /* Terminal-local parameters. */
 struct terminal
 {
-  /* The first two fields are really the header of a vector */
-  /* The terminal code does not refer to them.  */
-  EMACS_UINT size;
-  struct Lisp_Vector *vec_next;
+  /* This is for Lisp; the terminal code does not refer to it.  */
+  struct vector_header header;
 
   /* Parameter alist of this terminal.  */
   Lisp_Object param_alist;

=== modified file 'src/w32font.c'
--- src/w32font.c	2011-01-02 23:50:46 +0000
+++ src/w32font.c	2011-05-08 19:18:33 +0000
@@ -173,7 +173,7 @@ intern_font_name (string)
 
   /* The following code is copied from the function intern (in lread.c).  */
   obarray = Vobarray;
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     obarray = check_obarray (obarray);
   tem = oblookup (obarray, SDATA (str), len, len);
   if (SYMBOLP (tem))

=== modified file 'src/w32menu.c'
--- src/w32menu.c	2011-01-02 23:50:46 +0000
+++ src/w32menu.c	2011-05-08 18:32:58 +0000
@@ -464,11 +464,11 @@ set_frame_menubar (f, first_time, deep_p
 
       menu_items = f->menu_bar_vector;
       menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
-      submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
-      submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
-      submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int));
+      submenu_start = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
+      submenu_end = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
+      submenu_n_panes = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int));
       submenu_top_level_items
-	= (int *) alloca (XVECTOR (items)->size * sizeof (int *));
+	= (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
       init_menu_items ();
       for (i = 0; i < ASIZE (items); i += 4)
 	{

=== modified file 'src/window.c'
--- src/window.c	2011-02-09 00:11:15 +0000
+++ src/window.c	2011-05-08 18:32:58 +0000
@@ -5931,8 +5931,7 @@ zero means top of window, negative means
 
 struct save_window_data
   {
-    EMACS_UINT size;
-    struct Lisp_Vector *next_from_Lisp_Vector_struct;
+    struct vector_header header;
     Lisp_Object selected_frame;
     Lisp_Object current_window;
     Lisp_Object current_buffer;
@@ -5954,10 +5953,7 @@ struct save_window_data
 /* This is saved as a Lisp_Vector  */
 struct saved_window
 {
-  /* these first two must agree with struct Lisp_Vector in lisp.h */
-  EMACS_UINT size;
-  struct Lisp_Vector *next_from_Lisp_Vector_struct;
-
+  struct vector_header header;
   Lisp_Object window;
   Lisp_Object buffer, start, pointm, mark;
   Lisp_Object left_col, top_line, total_cols, total_lines;
@@ -6141,7 +6137,7 @@ the return value is nil.  Otherwise the 
 	 dead.  */
       delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f)));
 
-      for (k = 0; k < saved_windows->size; k++)
+      for (k = 0; k < saved_windows->header.size; k++)
 	{
 	  p = SAVED_WINDOW_N (saved_windows, k);
 	  w = XWINDOW (p->window);
@@ -7078,10 +7074,10 @@ compare_window_configurations (c1, c2, i
     return 0;
 
   /* Verify that the two confis have the same number of windows.  */
-  if (sw1->size != sw2->size)
+  if (sw1->header.size != sw2->header.size)
     return 0;
 
-  for (i = 0; i < sw1->size; i++)
+  for (i = 0; i < sw1->header.size; i++)
     {
       struct saved_window *p1, *p2;
       int w1_is_current, w2_is_current;

=== modified file 'src/window.h'
--- src/window.h	2011-01-02 23:50:46 +0000
+++ src/window.h	2011-05-08 18:32:58 +0000
@@ -89,10 +89,9 @@ struct cursor_pos
 
 struct window
   {
-    /* The first two fields are really the header of a vector */
-    /* The window code does not refer to them.  */
-    EMACS_UINT size;
-    struct Lisp_Vector *vec_next;
+    /* This is for Lisp; the terminal code does not refer to it.  */
+    struct vector_header header;
+
     /* The frame this window is on.  */
     Lisp_Object frame;
     /* t if this window is a minibuffer window.  */

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2011-04-13 18:19:23 +0000
+++ src/xdisp.c	2011-05-08 18:32:58 +0000
@@ -3865,7 +3865,7 @@ setup_for_ellipsis (it, len)
     {
       struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
       it->dpvec = v->contents;
-      it->dpend = v->contents + v->size;
+      it->dpend = v->contents + v->header.size;
     }
   else
     {
@@ -5697,11 +5697,11 @@ get_next_display_element (it)
 	      /* Return the first character from the display table
 		 entry, if not empty.  If empty, don't display the
 		 current character.  */
-	      if (v->size)
+	      if (v->header.size)
 		{
 		  it->dpvec_char_len = it->len;
 		  it->dpvec = v->contents;
-		  it->dpend = v->contents + v->size;
+		  it->dpend = v->contents + v->header.size;
 		  it->current.dpvec_index = 0;
 		  it->dpvec_face_id = -1;
 		  it->saved_face_id = it->face_id;
@@ -17087,7 +17087,7 @@ display_menu_bar (w)
 
   /* Display all items of the menu bar.  */
   items = FRAME_MENU_BAR_ITEMS (it.f);
-  for (i = 0; i < XVECTOR (items)->size; i += 4)
+  for (i = 0; i < XVECTOR_SIZE (items); i += 4)
     {
       Lisp_Object string;
 
@@ -23086,7 +23086,7 @@ on_hot_spot_p (hot_spot, x, y)
 	{
 	  struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot));
 	  Lisp_Object *poly = v->contents;
-	  int n = v->size;
+	  int n = v->header.size;
 	  int i;
 	  int inside = 0;
 	  Lisp_Object lx, ly;

=== modified file 'src/xfaces.c'
--- src/xfaces.c	2011-03-17 15:44:02 +0000
+++ src/xfaces.c	2011-05-08 18:32:58 +0000
@@ -1966,7 +1966,7 @@ the WIDTH times as wide as FACE on FRAME
 
 #define LFACEP(LFACE)					\
      (VECTORP (LFACE)					\
-      && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE	\
+      && XVECTOR_SIZE (LFACE) == LFACE_VECTOR_SIZE	\
       && EQ (AREF (LFACE, 0), Qface))
 
 

=== modified file 'src/xmenu.c'
--- src/xmenu.c	2011-04-08 20:41:28 +0000
+++ src/xmenu.c	2011-05-08 19:21:31 +0000
@@ -1012,6 +1012,7 @@ set_frame_menubar (f, first_time, deep_p
       Lisp_Object *previous_items
 	= (Lisp_Object *) alloca (previous_menu_items_used
 				  * sizeof (Lisp_Object));
+      EMACS_UINT subitems;
 
       /* If we are making a new widget, its contents are empty,
 	 do always reinitialize them.  */
@@ -1056,13 +1057,14 @@ set_frame_menubar (f, first_time, deep_p
 
       menu_items = f->menu_bar_vector;
       menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
-      submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
-      submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
-      submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int));
+      subitems = XVECTOR_SIZE (items) / 4;
+      submenu_start = (int *) alloca (subitems * sizeof (int *));
+      submenu_end = (int *) alloca (subitems * sizeof (int *));
+      submenu_n_panes = (int *) alloca (subitems * sizeof (int));
       submenu_top_level_items
-	= (int *) alloca (XVECTOR (items)->size * sizeof (int *));
+	= (int *) alloca (subitems * sizeof (int *));
       init_menu_items ();
-      for (i = 0; i < XVECTOR (items)->size; i += 4)
+      for (i = 0; i < subitems; i += 4)
 	{
 	  Lisp_Object key, string, maps;
 
@@ -1142,7 +1144,7 @@ set_frame_menubar (f, first_time, deep_p
       /* Now GC cannot happen during the lifetime of the widget_value,
 	 so it's safe to store data from a Lisp_String.  */
       wv = first_wv->contents;
-      for (i = 0; i < XVECTOR (items)->size; i += 4)
+      for (i = 0; i < XVECTOR_SIZE (items); i += 4)
 	{
 	  Lisp_Object string;
 	  string = XVECTOR (items)->contents[i + 1];
@@ -1168,7 +1170,7 @@ set_frame_menubar (f, first_time, deep_p
       first_wv = wv;
 
       items = FRAME_MENU_BAR_ITEMS (f);
-      for (i = 0; i < XVECTOR (items)->size; i += 4)
+      for (i = 0; i < XVECTOR_SIZE (items); i += 4)
 	{
 	  Lisp_Object string;
 

=== modified file 'src/xselect.c'
--- src/xselect.c	2011-04-08 20:41:28 +0000
+++ src/xselect.c	2011-05-08 18:32:58 +0000
@@ -486,7 +486,7 @@ x_get_local_selection (selection_symbol,
       int size;
       int i;
       pairs = XCDR (target_type);
-      size = XVECTOR (pairs)->size;
+      size = XVECTOR_SIZE (pairs);
       /* If the target is MULTIPLE, then target_type looks like
 	  (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ])
 	 We modify the second element of each pair in the vector and
@@ -1351,12 +1351,12 @@ copy_multiple_data (obj)
     return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj)));
 
   CHECK_VECTOR (obj);
-  vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil);
+  vec = Fmake_vector (size = XVECTOR_SIZE (obj), Qnil);
   for (i = 0; i < size; i++)
     {
       Lisp_Object vec2 = XVECTOR (obj)->contents [i];
       CHECK_VECTOR (vec2);
-      if (XVECTOR (vec2)->size != 2)
+      if (XVECTOR_SIZE (vec2) != 2)
 	/* ??? Confusing error message */
 	signal_error ("Vectors must be of length 2", vec2);
       XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil);
@@ -1996,7 +1996,7 @@ lisp_data_to_selection_data (display, ob
 	/* This vector is an ATOM set */
 	{
 	  if (NILP (type)) type = QATOM;
-	  *size_ret = XVECTOR (obj)->size;
+	  *size_ret = XVECTOR_SIZE (obj);
 	  *format_ret = 32;
 	  *data_ret = (unsigned char *) xmalloc ((*size_ret) * sizeof (Atom));
 	  for (i = 0; i < *size_ret; i++)
@@ -2011,7 +2011,7 @@ lisp_data_to_selection_data (display, ob
 	/* This vector is an ATOM_PAIR set */
 	{
 	  if (NILP (type)) type = QATOM_PAIR;
-	  *size_ret = XVECTOR (obj)->size;
+	  *size_ret = XVECTOR_SIZE (obj);
 	  *format_ret = 32;
 	  *data_ret = (unsigned char *)
 	    xmalloc ((*size_ret) * sizeof (Atom) * 2);
@@ -2019,7 +2019,7 @@ lisp_data_to_selection_data (display, ob
 	    if (VECTORP (XVECTOR (obj)->contents [i]))
 	      {
 		Lisp_Object pair = XVECTOR (obj)->contents [i];
-		if (XVECTOR (pair)->size != 2)
+		if (XVECTOR_SIZE (pair) != 2)
 		  signal_error (
 	"Elements of the vector must be vectors of exactly two elements",
 				pair);
@@ -2041,7 +2041,7 @@ lisp_data_to_selection_data (display, ob
 	/* This vector is an INTEGER set, or something like it */
 	{
           int data_size = 2;
-	  *size_ret = XVECTOR (obj)->size;
+	  *size_ret = XVECTOR_SIZE (obj);
 	  if (NILP (type)) type = QINTEGER;
 	  *format_ret = 16;
 	  for (i = 0; i < *size_ret; i++)
@@ -2095,7 +2095,7 @@ clean_local_selection_data (obj)
   if (VECTORP (obj))
     {
       int i;
-      int size = XVECTOR (obj)->size;
+      int size = XVECTOR_SIZE (obj);
       Lisp_Object copy;
       if (size == 1)
 	return clean_local_selection_data (XVECTOR (obj)->contents [0]);






^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-08 19:02                     ` Eli Zaretskii
@ 2011-05-09 10:10                       ` Eli Zaretskii
  2011-05-09 15:09                         ` Sven Joachim
  0 siblings, 1 reply; 20+ messages in thread
From: Eli Zaretskii @ 2011-05-09 10:10 UTC (permalink / raw)
  To: svenjoac, eggert; +Cc: 8623-done

> Date: Sun, 08 May 2011 22:02:57 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: eggert@cs.ucla.edu, 8623@debbugs.gnu.org
> 
>    cd emacs-23 && bzr merge -r103939.1.41..103939.1.42 ../trunk
> 
> because the changes you want were committed in revision 103939.1.42.

For the record, a few more revisions seem to be needed, I missed them
at first.  Here's the correct bzr command line:

  bzr merge -r103939.1.40..103939.1.44 ../trunk

I missed those other revisions because it is quite hard to figure out
which revisions committed by Paul on his local branch actually fix
this one problem.  The eventual merge onto the trunk (revision 104021)
included many more changes, which are unrelated to this problem.

Paul, would it be possible for you to merge individual features or
bugfixes?  Or at least clearly mark in the commit logs where a fix for
a particular problem begins and where it ends?  This would make such
jobs in the future much easier and less error-prone.  TIA

I committed the resulting changes (after fixing a few gotchas) to the
emacs-23 branch (revision 100571).  I only did some minimal testing,
so please report any residual bugs.  For now, I'm closing this bug
report.





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-08 19:27                     ` Eli Zaretskii
@ 2011-05-09 10:13                       ` Eli Zaretskii
  0 siblings, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2011-05-09 10:13 UTC (permalink / raw)
  To: svenjoac, eggert; +Cc: 8623

> Date: Sun, 08 May 2011 22:27:45 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: eggert@cs.ucla.edu, 8623@debbugs.gnu.org
> 
> Try the one below, I tried to resolve all the conflicts.  Caveat: I
> didn't attempt to build it, so it's possible that you will need a few
> more tweaks.

For the record, the final diffs (after building and fixing some more
problems) are below:

=== modified file 'src/ChangeLog'
--- src/ChangeLog	2011-04-29 14:23:44 +0000
+++ src/ChangeLog	2011-05-09 09:53:09 +0000
@@ -1,3 +1,71 @@
+2011-05-09  Eli Zaretskii  <eliz@gnu.org>
+
+	Backport revisions 103939.1.41..103939.1.44 (inclusive) from trunk.
+	(bug#8623)
+	The next log entry shows the actual changes by Paul Eggert.
+
+2011-05-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+	Fix a problem with aliasing and vector headers.
+	GCC 4.6.0 optimizes based on type-based alias analysis.  For
+	example, if b is of type struct buffer * and v of type struct
+	Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
+	!= &v->size, and therefore "v->size = 1; b->size = 2; return
+	v->size;" must therefore return 1.  This assumption is incorrect
+	for Emacs, since it type-puns struct Lisp_Vector * with many other
+	types.  To fix this problem, this patch adds a new type struct
+	vector_header that documents the constraints on layout of vectors
+	and pseudovectors, and helps optimizing compilers not get fooled
+	by Emacs's type punning.  It also adds the macros XSETTYPED_PVECTYPE
+	XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
+	* lisp.h (XVECTOR_SIZE): New convenience macro.  All previous uses of
+	XVECTOR (foo)->size replaced to use this macro, to avoid the hassle
+	of writing XVECTOR (foo)->header.size.
+	* lisp.h: Say "vectorlike header" rather than "vector header.
+	(struct vectorlike_header): Rename from struct vector_header.
+	(XVECTORLIKE_HEADER_SIZE): Renamed from XVECTOR_HEADER_SIZE.
+	All uses changed.
+	(XVECTOR_HEADER_SIZE): New macro, for use in XSETPSEUDOVECTOR.
+	(XSETTYPED_PVECTYPE): New macro, specifying the name of the size
+	member.
+	(XSETPVECTYPE): Rewrite in terms of new macro.
+	(XSETPVECTYPESIZE): New macro, specifying both type and size.
+	This is a bit clearer, and further avoids the possibility of
+	undesirable aliasing.
+	(XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
+	(XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR
+	and XVECTOR_HEADER_SIZE.
+	(XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
+	since Lisp_Subr is a special case (no "next" field).
+	(ASIZE): Rewrite in terms of XVECTOR_SIZE.
+	(struct vector_header): New type.
+	(TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
+	object, to help avoid aliasing.
+	(PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
+	(SUBRP): Likewise, since Lisp_Subr is a special case.
+
+	* lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
+	(struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
+	(struct Lisp_Hash_Table): Combine first two members into a single
+	struct vector_header member.  All uses of "size" and "next" members
+	changed to be "header.size" and "header.next".
+	* buffer.h (struct buffer): Likewise.
+	* font.h (struct font_spec, struct font_entity, struct font): Likewise.
+	* frame.h (struct frame): Likewise.
+	* process.h (struct Lisp_Process): Likewise.
+	* termhooks.h (struct terminal): Likewise.
+	* window.c (struct save_window_data, struct saved_window): Likewise.
+	* window.h (struct window): Likewise.
+	* alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
+	Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
+	* buffer.c (init_buffer_once): Likewise.
+	* lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
+	special case.
+	* process.c (Fformat_network_address): Use local var for size,
+	for brevity.
+	* fns.c (vector): Remove; this old hack is no longer needed.
+	* bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
+
 2011-04-29  Eli Zaretskii  <eliz@gnu.org>
 
 	* w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]:

=== modified file 'src/alloc.c'
--- src/alloc.c	2011-01-02 23:50:46 +0000
+++ src/alloc.c	2011-05-09 09:45:58 +0000
@@ -163,9 +163,9 @@ static __malloc_size_t bytes_used_when_r
 #define UNMARK_STRING(S)	((S)->size &= ~ARRAY_MARK_FLAG)
 #define STRING_MARKED_P(S)	(((S)->size & ARRAY_MARK_FLAG) != 0)
 
-#define VECTOR_MARK(V)		((V)->size |= ARRAY_MARK_FLAG)
-#define VECTOR_UNMARK(V)	((V)->size &= ~ARRAY_MARK_FLAG)
-#define VECTOR_MARKED_P(V)	(((V)->size & ARRAY_MARK_FLAG) != 0)
+#define VECTOR_MARK(V)		((V)->header.size |= ARRAY_MARK_FLAG)
+#define VECTOR_UNMARK(V)	((V)->header.size &= ~ARRAY_MARK_FLAG)
+#define VECTOR_MARKED_P(V)	(((V)->header.size & ARRAY_MARK_FLAG) != 0)
 
 /* Value is the number of bytes/chars of S, a pointer to a struct
    Lisp_String.  This must be used instead of STRING_BYTES (S) or
@@ -1151,8 +1151,9 @@ allocate_buffer ()
   struct buffer *b
     = (struct buffer *) lisp_malloc (sizeof (struct buffer),
 				     MEM_TYPE_BUFFER);
-  b->size = sizeof (struct buffer) / sizeof (EMACS_INT);
-  XSETPVECTYPE (b, PVEC_BUFFER);
+  XSETPVECTYPESIZE (b, PVEC_BUFFER,
+		    ((sizeof (struct buffer) + sizeof (EMACS_INT) - 1)
+		     / sizeof (EMACS_INT)));
   return b;
 }
 
@@ -2341,10 +2342,8 @@ LENGTH must be a number.  INIT matters o
      slot `size' of the struct Lisp_Bool_Vector.  */
   val = Fmake_vector (make_number (length_in_elts + 1), Qnil);
 
-  /* Get rid of any bits that would cause confusion.  */
-  XVECTOR (val)->size = 0;	/* No Lisp_Object to trace in there.  */
-  /* Use  XVECTOR (val) rather than `p' because p->size is not TRT. */
-  XSETPVECTYPE (XVECTOR (val), PVEC_BOOL_VECTOR);
+  /* No Lisp_Object to trace in there.  */
+  XSETPVECTYPESIZE (XVECTOR (val), PVEC_BOOL_VECTOR, 0);
 
   p = XBOOL_VECTOR (val);
   p->size = XFASTINT (length);
@@ -2943,7 +2942,7 @@ allocate_vectorlike (len)
   consing_since_gc += nbytes;
   vector_cells_consed += len;
 
-  p->next = all_vectors;
+  p->header.next.vector = all_vectors;
   all_vectors = p;
 
   MALLOC_UNBLOCK_INPUT;
@@ -2960,7 +2959,7 @@ allocate_vector (nslots)
      EMACS_INT nslots;
 {
   struct Lisp_Vector *v = allocate_vectorlike (nslots);
-  v->size = nslots;
+  v->header.size = nslots;
   return v;
 }
 
@@ -2976,11 +2975,10 @@ allocate_pseudovector (memlen, lisplen, 
   EMACS_INT i;
 
   /* Only the first lisplen slots will be traced normally by the GC.  */
-  v->size = lisplen;
   for (i = 0; i < lisplen; ++i)
     v->contents[i] = Qnil;
 
-  XSETPVECTYPE (v, tag);	/* Add the appropriate tag.  */
+  XSETPVECTYPESIZE (v, tag, lisplen);
   return v;
 }
 
@@ -4884,7 +4882,7 @@ make_pure_vector (len)
 
   p = (struct Lisp_Vector *) pure_alloc (size, Lisp_Vectorlike);
   XSETVECTOR (new, p);
-  XVECTOR (new)->size = len;
+  XVECTOR (new)->header.size = len;
   return new;
 }
 
@@ -4916,7 +4914,7 @@ Does not copy symbols.  Copies strings w
       register int i;
       EMACS_INT size;
 
-      size = XVECTOR (obj)->size;
+      size = XVECTOR_SIZE (obj);
       if (size & PSEUDOVECTOR_FLAG)
 	size &= PSEUDOVECTOR_SIZE_MASK;
       vec = XVECTOR (make_pure_vector (size));
@@ -5038,7 +5036,7 @@ returns nil, because real GC can't be do
 	      }
 	  }
 
-	nextb = nextb->next;
+	nextb = nextb->header.next.buffer;
       }
   }
 
@@ -5184,7 +5182,7 @@ returns nil, because real GC can't be do
 	   undo_list any more, we can finally mark the list.  */
 	mark_object (nextb->undo_list);
 
-	nextb = nextb->next;
+	nextb = nextb->header.next.buffer;
       }
   }
 
@@ -5361,7 +5359,7 @@ static void
 mark_vectorlike (ptr)
      struct Lisp_Vector *ptr;
 {
-  register EMACS_INT size = ptr->size;
+  register EMACS_UINT size = ptr->header.size;
   register int i;
 
   eassert (!VECTOR_MARKED_P (ptr));
@@ -5385,7 +5383,7 @@ static void
 mark_char_table (ptr)
      struct Lisp_Vector *ptr;
 {
-  register EMACS_INT size = ptr->size & PSEUDOVECTOR_SIZE_MASK;
+  register EMACS_UINT size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK;
   register int i;
 
   eassert (!VECTOR_MARKED_P (ptr));
@@ -5500,7 +5498,7 @@ mark_object (arg)
 	  if (po != &buffer_defaults && po != &buffer_local_symbols)
 	    {
 	      struct buffer *b;
-	      for (b = all_buffers; b && b != po; b = b->next)
+	      for (b = all_buffers; b && b != po; b = b->header.next.buffer)
 		;
 	      if (b == NULL)
 		abort ();
@@ -5516,7 +5514,7 @@ mark_object (arg)
 	   recursion there.  */
 	{
 	  register struct Lisp_Vector *ptr = XVECTOR (obj);
-	  register EMACS_INT size = ptr->size;
+	  register EMACS_UINT size = ptr->header.size;
 	  register int i;
 
 	  CHECK_LIVE (live_vector_p);
@@ -6150,10 +6148,10 @@ gc_sweep ()
       if (!VECTOR_MARKED_P (buffer))
 	{
 	  if (prev)
-	    prev->next = buffer->next;
+	    prev->header.next = buffer->header.next;
 	  else
-	    all_buffers = buffer->next;
-	  next = buffer->next;
+	    all_buffers = buffer->header.next.buffer;
+	  next = buffer->header.next.buffer;
 	  lisp_free (buffer);
 	  buffer = next;
 	}
@@ -6161,7 +6159,7 @@ gc_sweep ()
 	{
 	  VECTOR_UNMARK (buffer);
 	  UNMARK_BALANCE_INTERVALS (BUF_INTERVALS (buffer));
-	  prev = buffer, buffer = buffer->next;
+	  prev = buffer, buffer = buffer->header.next.buffer;
 	}
   }
 
@@ -6174,10 +6172,10 @@ gc_sweep ()
       if (!VECTOR_MARKED_P (vector))
 	{
 	  if (prev)
-	    prev->next = vector->next;
+	    prev->header.next = vector->header.next;
 	  else
-	    all_vectors = vector->next;
-	  next = vector->next;
+	    all_vectors = vector->header.next.vector;
+	  next = vector->header.next.vector;
 	  lisp_free (vector);
 	  n_vectors--;
 	  vector = next;
@@ -6186,11 +6184,11 @@ gc_sweep ()
       else
 	{
 	  VECTOR_UNMARK (vector);
-	  if (vector->size & PSEUDOVECTOR_FLAG)
-	    total_vector_size += (PSEUDOVECTOR_SIZE_MASK & vector->size);
+	  if (vector->header.size & PSEUDOVECTOR_FLAG)
+	    total_vector_size += PSEUDOVECTOR_SIZE_MASK & vector->header.size;
 	  else
-	    total_vector_size += vector->size;
-	  prev = vector, vector = vector->next;
+	    total_vector_size += vector->header.size;
+	  prev = vector, vector = vector->header.next.vector;
 	}
   }
 

=== modified file 'src/buffer.c'
--- src/buffer.c	2011-04-10 20:55:52 +0000
+++ src/buffer.c	2011-05-09 09:46:21 +0000
@@ -53,7 +53,7 @@ extern int errno;
 struct buffer *current_buffer;		/* the current buffer */
 
 /* First buffer in chain of all buffers (in reverse order of creation).
-   Threaded through ->next.  */
+   Threaded through ->header.next.buffer.  */
 
 struct buffer *all_buffers;
 
@@ -400,7 +400,7 @@ even if it is dead.  The return value is
   b->prevent_redisplay_optimizations_p = 1;
 
   /* Put this on the chain of all buffers including killed ones.  */
-  b->next = all_buffers;
+  b->header.next.buffer = all_buffers;
   all_buffers = b;
 
   /* An ordinary buffer normally doesn't need markers
@@ -633,7 +633,7 @@ CLONE nil means the indirect buffer's st
   b->width_table = Qnil;
 
   /* Put this on the chain of all buffers including killed ones.  */
-  b->next = all_buffers;
+  b->header.next.buffer = all_buffers;
   all_buffers = b;
 
   name = Fcopy_sequence (name);
@@ -1544,7 +1544,7 @@ with SIGHUP.  */)
 
       GCPRO1 (buffer);
 
-      for (other = all_buffers; other; other = other->next)
+      for (other = all_buffers; other; other = other->header.next.buffer)
 	/* all_buffers contains dead buffers too;
 	   don't re-kill them.  */
 	if (other->base_buffer == b && !NILP (other->name))
@@ -2214,7 +2214,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_
 
   { /* This is probably harder to make work.  */
     struct buffer *other;
-    for (other = all_buffers; other; other = other->next)
+    for (other = all_buffers; other; other = other->header.next.buffer)
       if (other->base_buffer == other_buffer
 	  || other->base_buffer == current_buffer)
 	error ("One of the buffers to swap has indirect buffers");
@@ -2585,7 +2585,7 @@ current buffer is cleared.  */)
 
   /* Copy this buffer's new multibyte status
      into all of its indirect buffers.  */
-  for (other = all_buffers; other; other = other->next)
+  for (other = all_buffers; other; other = other->header.next.buffer)
     if (other->base_buffer == current_buffer && !NILP (other->name))
       {
 	other->enable_multibyte_characters
@@ -4346,7 +4346,7 @@ static void
 add_overlay_mod_hooklist (functionlist, overlay)
      Lisp_Object functionlist, overlay;
 {
-  int oldsize = XVECTOR (last_overlay_modification_hooks)->size;
+  int oldsize = XVECTOR_SIZE (last_overlay_modification_hooks);
 
   if (last_overlay_modification_hooks_used == oldsize)
     last_overlay_modification_hooks = larger_vector 
@@ -5150,9 +5150,9 @@ init_buffer_once ()
   buffer_local_symbols.text = &buffer_local_symbols.own_text;
   BUF_INTERVALS (&buffer_defaults) = 0;
   BUF_INTERVALS (&buffer_local_symbols) = 0;
-  XSETPVECTYPE (&buffer_defaults, PVEC_BUFFER);
+  XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0);
   XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
-  XSETPVECTYPE (&buffer_local_symbols, PVEC_BUFFER);
+  XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0);
   XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
 
   /* Set up the default values of various buffer slots.  */

=== modified file 'src/buffer.h'
--- src/buffer.h	2011-03-19 16:42:53 +0000
+++ src/buffer.h	2011-05-09 09:48:57 +0000
@@ -487,14 +487,13 @@ struct buffer
 
      Check out mark_buffer (alloc.c) to see why.  */
 
-  EMACS_UINT size;
-
-  /* Next buffer, in chain of all buffers including killed buffers.
+  /* HEADER.NEXT is the next buffer, in chain of all buffers,
+     including killed buffers.
      This chain is used only for garbage collection, in order to
      collect killed buffers properly.
      Note that vectors and most pseudovectors are all on one chain,
      but buffers are on a separate chain of their own.  */
-  struct buffer *next;
+  struct vectorlike_header header;
 
   /* This structure holds the coordinates of the buffer contents
      in ordinary buffers.  In indirect buffers, this is not used.  */

=== modified file 'src/bytecode.c'
--- src/bytecode.c	2011-01-02 23:50:46 +0000
+++ src/bytecode.c	2011-05-09 09:34:44 +0000
@@ -415,7 +415,7 @@ If the third argument is incorrect, Emac
   /* Lisp_Object v1, v2; */
   Lisp_Object *vectorp;
 #ifdef BYTE_CODE_SAFE
-  int const_length = XVECTOR (vector)->size;
+  int const_length;
   Lisp_Object *stacke;
 #endif
   int bytestr_length;
@@ -437,6 +437,9 @@ If the third argument is incorrect, Emac
   CHECK_VECTOR (vector);
   CHECK_NUMBER (maxdepth);
 
+#ifdef BYTE_CODE_SAFE
+  const_length = XVECTOR_SIZE (vector);
+#endif
   if (STRING_MULTIBYTE (bytestr))
     /* BYTESTR must have been produced by Emacs 20.2 or the earlier
        because they produced a raw 8-bit string for byte-code and now

=== modified file 'src/callint.c'
--- src/callint.c	2011-01-02 23:50:46 +0000
+++ src/callint.c	2011-05-09 08:56:23 +0000
@@ -313,7 +313,7 @@ invoke it.  If KEYS is omitted or nil, t
   else
     {
       CHECK_VECTOR (keys);
-      key_count = XVECTOR (keys)->size;
+      key_count = XVECTOR_SIZE (keys);
     }
 
   /* Save this now, since use of minibuffer will clobber it. */

=== modified file 'src/ccl.c'
--- src/ccl.c	2011-01-02 23:50:46 +0000
+++ src/ccl.c	2011-05-09 08:56:23 +0000
@@ -1924,7 +1924,7 @@ setup_ccl_program (ccl, ccl_prog)
       if (! VECTORP (ccl_prog))
 	return -1;
       vp = XVECTOR (ccl_prog);
-      ccl->size = vp->size;
+      ccl->size = vp->header.size;
       ccl->prog = vp->contents;
       ccl->eof_ic = XINT (vp->contents[CCL_HEADER_EOF]);
       ccl->buf_magnification = XINT (vp->contents[CCL_HEADER_BUF_MAG]);

=== modified file 'src/character.c'
--- src/character.c	2011-02-23 19:56:30 +0000
+++ src/character.c	2011-05-09 08:56:23 +0000
@@ -411,7 +411,7 @@ c_string_width (const unsigned char *str
 	{
 	  val = DISP_CHAR_VECTOR (dp, c);
 	  if (VECTORP (val))
-	    thiswidth = XVECTOR (val)->size;
+	    thiswidth = XVECTOR_SIZE (val);
 	  else
 	    thiswidth = CHAR_WIDTH (c);
 	}
@@ -503,7 +503,7 @@ lisp_string_width (string, precision, nc
 	    {
 	      val = DISP_CHAR_VECTOR (dp, c);
 	      if (VECTORP (val))
-		thiswidth = XVECTOR (val)->size;
+		thiswidth = XVECTOR_SIZE (val);
 	      else
 		thiswidth = CHAR_WIDTH (c);
 	    }

=== modified file 'src/chartab.c'
--- src/chartab.c	2011-01-02 23:50:46 +0000
+++ src/chartab.c	2011-05-09 08:56:23 +0000
@@ -152,7 +152,7 @@ copy_char_table (table)
      Lisp_Object table;
 {
   Lisp_Object copy;
-  int size = XCHAR_TABLE (table)->size & PSEUDOVECTOR_SIZE_MASK;
+  int size = XCHAR_TABLE (table)->header.size & PSEUDOVECTOR_SIZE_MASK;
   int i;
 
   copy = Fmake_vector (make_number (size), Qnil);

=== modified file 'src/coding.c'
--- src/coding.c	2011-01-02 23:50:46 +0000
+++ src/coding.c	2011-05-09 08:56:23 +0000
@@ -7339,7 +7339,7 @@ handle_composition_annotation (pos, limi
 	      components = COMPOSITION_COMPONENTS (prop);
 	      if (VECTORP (components))
 		{
-		  len = XVECTOR (components)->size;
+		  len = XVECTOR_SIZE (components);
 		  for (i = 0; i < len; i++)
 		    *buf++ = XINT (AREF (components, i));
 		}

=== modified file 'src/composite.c'
--- src/composite.c	2011-01-02 23:50:46 +0000
+++ src/composite.c	2011-05-09 08:56:23 +0000
@@ -300,7 +300,7 @@ get_composition_id (charpos, bytepos, nc
     }
   else if (VECTORP (components) || CONSP (components))
     {
-      int len = XVECTOR (key)->size;
+      EMACS_UINT len = XVECTOR_SIZE (key);
 
       /* The number of elements should be odd.  */
       if ((len % 2) == 0)
@@ -333,8 +333,8 @@ get_composition_id (charpos, bytepos, nc
 		    : COMPOSITION_WITH_RULE_ALTCHARS));
   cmp->hash_index = hash_index;
   glyph_len = (cmp->method == COMPOSITION_WITH_RULE_ALTCHARS
-	       ? (XVECTOR (key)->size + 1) / 2
-	       : XVECTOR (key)->size);
+	       ? (XVECTOR_SIZE (key) + 1) / 2
+	       : XVECTOR_SIZE (key));
   cmp->glyph_len = glyph_len;
   cmp->offsets = (short *) xmalloc (sizeof (short) * glyph_len * 2);
   cmp->font = NULL;

=== modified file 'src/data.c'
--- src/data.c	2011-01-02 23:50:46 +0000
+++ src/data.c	2011-05-09 08:56:23 +0000
@@ -1402,7 +1402,7 @@ for this variable.  */)
 	{
 	  struct buffer *b;
 
-	  for (b = all_buffers; b; b = b->next)
+	  for (b = all_buffers; b; b = b->header.next.buffer)
 	    if (!PER_BUFFER_VALUE_P (b, idx))
 	      PER_BUFFER_VALUE (b, offset) = value;
 	}
@@ -2029,9 +2029,9 @@ or a byte-code object.  IDX starts at 0.
     {
       int size = 0;
       if (VECTORP (array))
-	size = XVECTOR (array)->size;
+	size = XVECTOR_SIZE (array);
       else if (COMPILEDP (array))
-	size = XVECTOR (array)->size & PSEUDOVECTOR_SIZE_MASK;
+	size = XVECTOR_SIZE (array) & PSEUDOVECTOR_SIZE_MASK;
       else
 	wrong_type_argument (Qarrayp, array);
 
@@ -2058,7 +2058,7 @@ bool-vector.  IDX starts at 0.  */)
 
   if (VECTORP (array))
     {
-      if (idxval < 0 || idxval >= XVECTOR (array)->size)
+      if (idxval < 0 || idxval >= XVECTOR_SIZE (array))
 	args_out_of_range (array, idx);
       XVECTOR (array)->contents[idxval] = newelt;
     }

=== modified file 'src/dispnew.c'
--- src/dispnew.c	2011-01-02 23:50:46 +0000
+++ src/dispnew.c	2011-05-09 08:56:23 +0000
@@ -6729,7 +6729,7 @@ pass nil for VARIABLE.  */)
     state = frame_and_buffer_state;
 
   vecp = XVECTOR (state)->contents;
-  end = vecp + XVECTOR (state)->size;
+  end = vecp + XVECTOR_SIZE (state);
 
   FOR_EACH_FRAME (tail, frame)
     {
@@ -6780,8 +6780,8 @@ pass nil for VARIABLE.  */)
   /* Reallocate the vector if data has grown to need it,
      or if it has shrunk a lot.  */
   if (! VECTORP (state)
-      || n > XVECTOR (state)->size
-      || n + 20 < XVECTOR (state)->size / 2)
+      || n > XVECTOR_SIZE (state)
+      || n + 20 < XVECTOR_SIZE (state) / 2)
     /* Add 20 extra so we grow it less often.  */
     {
       state = Fmake_vector (make_number (n + 20), Qlambda);
@@ -6811,11 +6811,11 @@ pass nil for VARIABLE.  */)
   /* Fill up the vector with lambdas (always at least one).  */
   *vecp++ = Qlambda;
   while (vecp - XVECTOR (state)->contents
-	 < XVECTOR (state)->size)
+	 < XVECTOR_SIZE (state))
     *vecp++ = Qlambda;
   /* Make sure we didn't overflow the vector.  */
   if (vecp - XVECTOR (state)->contents
-      > XVECTOR (state)->size)
+      > XVECTOR_SIZE (state))
     abort ();
   return Qt;
 }

=== modified file 'src/disptab.h'
--- src/disptab.h	2011-01-02 23:50:46 +0000
+++ src/disptab.h	2011-05-09 08:56:23 +0000
@@ -62,7 +62,7 @@ extern Lisp_Object Vglyph_table;
 /* Return the current length of the GLYPH table,
    or 0 if the table isn't currently valid.  */
 #define GLYPH_TABLE_LENGTH  \
-  ((VECTORP (Vglyph_table)) ? XVECTOR (Vglyph_table)->size : 0)
+  ((VECTORP (Vglyph_table)) ? XVECTOR_SIZE (Vglyph_table) : 0)
 
 /* Return the current base (for indexing) of the GLYPH table,
    or 0 if the table isn't currently valid.  */

=== modified file 'src/doc.c'
--- src/doc.c	2011-01-02 23:50:46 +0000
+++ src/doc.c	2011-05-09 08:56:23 +0000
@@ -809,7 +809,7 @@ a new string, without any text propertie
 	do_remap:
 	  tem = Fwhere_is_internal (name, keymap, Qt, Qnil, Qnil);
 
-	  if (VECTORP (tem) && XVECTOR (tem)->size > 1
+	  if (VECTORP (tem) && XVECTOR_SIZE (tem) > 1
 	      && EQ (AREF (tem, 0), Qremap) && SYMBOLP (AREF (tem, 1))
 	      && follow_remap)
 	    {

=== modified file 'src/fns.c'
--- src/fns.c	2011-01-02 23:50:46 +0000
+++ src/fns.c	2011-05-09 09:22:21 +0000
@@ -27,11 +27,6 @@ along with GNU Emacs.  If not, see <http
 #include <time.h>
 #include <setjmp.h>
 
-/* Note on some machines this defines `vector' as a typedef,
-   so make sure we don't use that name in this file.  */
-#undef vector
-#define vector *****
-
 #include "lisp.h"
 #include "commands.h"
 #include "character.h"
@@ -4022,9 +4017,9 @@ copy_hash_table (h1)
   struct Lisp_Vector *next;
 
   h2 = allocate_hash_table ();
-  next = h2->vec_next;
+  next = h2->header.next.vector;
   bcopy (h1, h2, sizeof *h2);
-  h2->vec_next = next;
+  h2->header.next.vector = next;
   h2->key_and_value = Fcopy_sequence (h1->key_and_value);
   h2->hash = Fcopy_sequence (h1->hash);
   h2->next = Fcopy_sequence (h1->next);
@@ -4379,7 +4374,7 @@ sweep_weak_hash_tables ()
       marked = 0;
       for (h = weak_hash_tables; h; h = h->next_weak)
 	{
-	  if (h->size & ARRAY_MARK_FLAG)
+	  if (h->header.size & ARRAY_MARK_FLAG)
 	    marked |= sweep_weak_table (h, 0);
 	}
     }
@@ -4390,7 +4385,7 @@ sweep_weak_hash_tables ()
     {
       next = h->next_weak;
 
-      if (h->size & ARRAY_MARK_FLAG)
+      if (h->header.size & ARRAY_MARK_FLAG)
 	{
 	  /* TABLE is marked as used.  Sweep its contents.  */
 	  if (h->count > 0)
@@ -4513,7 +4508,7 @@ sxhash_bool_vector (vec)
   unsigned hash = XBOOL_VECTOR (vec)->size;
   int i, n;
 
-  n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->vector_size);
+  n = min (SXHASH_MAX_LEN, XBOOL_VECTOR (vec)->header.size);
   for (i = 0; i < n; ++i)
     hash = SXHASH_COMBINE (hash, XBOOL_VECTOR (vec)->data[i]);
 

=== modified file 'src/font.c'
--- src/font.c	2011-02-23 01:56:49 +0000
+++ src/font.c	2011-05-09 08:56:23 +0000
@@ -269,7 +269,7 @@ font_intern_prop (str, len, force_symbol
   /* The following code is copied from the function intern (in
      lread.c), and modified to suite our purpose.  */
   obarray = Vobarray;
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     obarray = check_obarray (obarray);
   parse_str_as_multibyte ((unsigned char *) str, len, &nchars, &nbytes);
   if (len == nchars || len != nbytes)

=== modified file 'src/font.h'
--- src/font.h	2011-01-02 23:50:46 +0000
+++ src/font.h	2011-05-09 09:48:57 +0000
@@ -247,8 +247,7 @@ extern Lisp_Object Qja, Qko;
 
 struct font_spec
 {
-  EMACS_UINT size;
-  struct Lisp_Vector *next;
+  struct vectorlike_header header;
   Lisp_Object props[FONT_SPEC_MAX];
 };
 
@@ -256,8 +255,7 @@ struct font_spec
 
 struct font_entity
 {
-  EMACS_UINT size;
-  struct Lisp_Vector *next;
+  struct vectorlike_header header;
   Lisp_Object props[FONT_ENTITY_MAX];
 };
 
@@ -270,8 +268,7 @@ struct font_entity
 
 struct font
 {
-  EMACS_UINT size;
-  struct Lisp_Vector *next;
+  struct vectorlike_header header;
 
   /* All Lisp_Object components must come first.
      That ensures they are all aligned normally.  */

=== modified file 'src/frame.h'
--- src/frame.h	2011-01-02 23:50:46 +0000
+++ src/frame.h	2011-05-09 09:48:57 +0000
@@ -93,8 +93,7 @@ struct font_driver_list;
 
 struct frame
 {
-  EMACS_UINT size;
-  struct Lisp_Vector *next;
+  struct vectorlike_header header;
 
   /* All Lisp_Object components must come first.
      That ensures they are all aligned normally.  */

=== modified file 'src/fringe.c'
--- src/fringe.c	2011-03-11 03:56:20 +0000
+++ src/fringe.c	2011-05-09 08:56:23 +0000
@@ -1569,7 +1569,7 @@ If BITMAP already exists, the existing d
   if (STRINGP (bits))
     h = SCHARS (bits);
   else if (VECTORP (bits))
-    h = XVECTOR (bits)->size;
+    h = XVECTOR_SIZE (bits);
   else
     wrong_type_argument (Qsequencep, bits);
 

=== modified file 'src/image.c'
--- src/image.c	2011-01-29 23:56:33 +0000
+++ src/image.c	2011-05-09 08:56:23 +0000
@@ -2459,7 +2459,7 @@ xbm_image_p (object)
 	  int i;
 
 	  /* Number of elements of the vector must be >= height.  */
-	  if (XVECTOR (data)->size < height)
+	  if (XVECTOR_SIZE (data) < height)
 	    return 0;
 
 	  /* Each string or bool-vector in data must be large enough
@@ -8083,7 +8083,7 @@ gs_image_p (object)
     }
   else if (VECTORP (tem))
     {
-      if (XVECTOR (tem)->size != 4)
+      if (XVECTOR_SIZE (tem) != 4)
 	return 0;
       for (i = 0; i < 4; ++i)
 	if (!INTEGERP (XVECTOR (tem)->contents[i]))

=== modified file 'src/indent.c'
--- src/indent.c	2011-01-02 23:50:46 +0000
+++ src/indent.c	2011-05-09 09:06:22 +0000
@@ -101,7 +101,7 @@ character_width (c, dp)
   /* Everything can be handled by the display table, if it's
      present and the element is right.  */
   if (dp && (elt = DISP_CHAR_VECTOR (dp, c), VECTORP (elt)))
-    return XVECTOR (elt)->size;
+    return XVECTOR_SIZE (elt);
 
   /* Some characters are special.  */
   if (c == '\n' || c == '\t' || c == '\015')
@@ -131,7 +131,7 @@ disptab_matches_widthtab (disptab, width
 {
   int i;
 
-  if (widthtab->size != 256)
+  if (widthtab->header.size != 256)
     abort ();
 
   for (i = 0; i < 256; i++)
@@ -155,7 +155,7 @@ recompute_width_table (buf, disptab)
   if (!VECTORP (buf->width_table))
     buf->width_table = Fmake_vector (make_number (256), make_number (0));
   widthtab = XVECTOR (buf->width_table);
-  if (widthtab->size != 256)
+  if (widthtab->header.size != 256)
     abort ();
 
   for (i = 0; i < 256; i++)
@@ -301,7 +301,7 @@ skip_invisible (pos, next_boundary_p, to
     else								\
       {									\
 	if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))		\
-	  width = XVECTOR (DISP_CHAR_VECTOR (dp, c))->size;		\
+	  width = XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, c));		\
 	else								\
 	  width = CHAR_WIDTH (c);					\
 	if (width > 1)							\
@@ -786,7 +786,7 @@ string_display_width (string, beg, end)
 
       c = *--ptr;
       if (dp != 0 && VECTORP (DISP_CHAR_VECTOR (dp, c)))
-	col += XVECTOR (DISP_CHAR_VECTOR (dp, c))->size;
+	col += XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, c));
       else if (c >= 040 && c < 0177)
 	col++;
       else if (c == '\n')
@@ -1159,7 +1159,7 @@ compute_motion (from, fromvpos, fromhpos
        : !NILP (current_buffer->selective_display) ? -1 : 0);
   int selective_rlen
     = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
-       ? XVECTOR (DISP_INVIS_VECTOR (dp))->size : 0);
+       ? XVECTOR_SIZE (DISP_INVIS_VECTOR (dp)) : 0);
   /* The next location where the `invisible' property changes, or an
      overlay starts or ends.  */
   EMACS_INT next_boundary = from;

=== modified file 'src/keyboard.c'
--- src/keyboard.c	2011-01-02 23:50:46 +0000
+++ src/keyboard.c	2011-05-09 08:59:30 +0000
@@ -137,7 +137,7 @@ int raw_keybuf_count;
 Lisp_Object Vthis_command_keys_shift_translated;
 
 #define GROW_RAW_KEYBUF							\
- if (raw_keybuf_count == XVECTOR (raw_keybuf)->size)			\
+ if (raw_keybuf_count == XVECTOR_SIZE (raw_keybuf))			\
    raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil)  \
 
 /* Number of elements of this_command_keys
@@ -1774,7 +1774,7 @@ command_loop_1 ()
 		  if (PT == last_point_position + 1
 		      && (dp
 			  ? (VECTORP (DISP_CHAR_VECTOR (dp, lose))
-			     ? XVECTOR (DISP_CHAR_VECTOR (dp, lose))->size == 1
+			     ? XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, lose)) == 1
 			     : (NILP (DISP_CHAR_VECTOR (dp, lose))
 				&& (lose >= 0x20 && lose < 0x7f)))
 			  : (lose >= 0x20 && lose < 0x7f))
@@ -1814,7 +1814,7 @@ command_loop_1 ()
 		  if (PT == last_point_position - 1
 		      && (dp
 			  ? (VECTORP (DISP_CHAR_VECTOR (dp, lose))
-			     ? XVECTOR (DISP_CHAR_VECTOR (dp, lose))->size == 1
+			     ? XVECTOR_SIZE (DISP_CHAR_VECTOR (dp, lose)) == 1
 			     : (NILP (DISP_CHAR_VECTOR (dp, lose))
 				&& (lose >= 0x20 && lose < 0x7f)))
 			  : (lose >= 0x20 && lose < 0x7f))
@@ -3203,7 +3203,7 @@ read_char (commandflag, nmaps, maps, pre
       if ((STRINGP (current_kboard->Vkeyboard_translate_table)
 	   && SCHARS (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c))
 	  || (VECTORP (current_kboard->Vkeyboard_translate_table)
-	      && XVECTOR (current_kboard->Vkeyboard_translate_table)->size > (unsigned) XFASTINT (c))
+	      && XVECTOR_SIZE (current_kboard->Vkeyboard_translate_table) > (unsigned) XFASTINT (c))
 	  || (CHAR_TABLE_P (current_kboard->Vkeyboard_translate_table)
 	      && CHARACTERP (c)))
 	{
@@ -4552,7 +4552,7 @@ timer_start_idle ()
 
       timer = XCAR (timers);
 
-      if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+      if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
 	continue;
       XVECTOR (timer)->contents[0] = Qnil;
     }
@@ -4646,7 +4646,7 @@ timer_check_2 ()
       if (!NILP (timers))
 	{
 	  timer = XCAR (timers);
-	  if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+	  if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
 	    {
 	      timers = XCDR (timers);
 	      continue;
@@ -4664,7 +4664,7 @@ timer_check_2 ()
       if (!NILP (idle_timers))
 	{
 	  timer = XCAR (idle_timers);
-	  if (!VECTORP (timer) || XVECTOR (timer)->size != 8)
+	  if (!VECTORP (timer) || XVECTOR_SIZE (timer) != 8)
 	    {
 	      idle_timers = XCDR (idle_timers);
 	      continue;
@@ -5830,7 +5830,7 @@ make_lispy_event (event)
 		/* Find the menu bar item under `column'.  */
 		item = Qnil;
 		items = FRAME_MENU_BAR_ITEMS (f);
-		for (i = 0; i < XVECTOR (items)->size; i += 4)
+		for (i = 0; i < XVECTOR_SIZE (items); i += 4)
 		  {
 		    Lisp_Object pos, string;
 		    string = AREF (items, i + 1);
@@ -6025,7 +6025,7 @@ make_lispy_event (event)
 				      Qmouse_click, Vlispy_mouse_stem,
 				      NULL,
 				      &mouse_syms,
-				      XVECTOR (mouse_syms)->size);
+				      XVECTOR_SIZE (mouse_syms));
 	  if (event->modifiers & drag_modifier)
 	    return Fcons (head,
 			  Fcons (start_pos,
@@ -6198,7 +6198,7 @@ make_lispy_event (event)
 				    Qmouse_click,
 				    Vlispy_mouse_stem,
 				    NULL, &mouse_syms,
-				    XVECTOR (mouse_syms)->size);
+				    XVECTOR_SIZE (mouse_syms));
 	return Fcons (head, Fcons (position, Qnil));
       }
 
@@ -6318,7 +6318,7 @@ make_lispy_event (event)
 				    Qmouse_click, Vlispy_mouse_stem,
 				    NULL,
 				    &mouse_syms,
-				    XVECTOR (mouse_syms)->size);
+				    XVECTOR_SIZE (mouse_syms));
 
 	if (event->modifiers & drag_modifier)
 	  return Fcons (head,
@@ -6825,7 +6825,7 @@ modify_event_symbol (symbol_num, modifie
   else
     {
       if (! VECTORP (*symbol_table)
-	  || XVECTOR (*symbol_table)->size != table_size)
+	  || XVECTOR_SIZE (*symbol_table) != table_size)
 	{
 	  Lisp_Object size;
 
@@ -7865,7 +7865,7 @@ menu_bar_items (old)
 
   /* Add nil, nil, nil, nil at the end.  */
   i = menu_bar_items_index;
-  if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
+  if (i + 4 > XVECTOR_SIZE (menu_bar_items_vector))
     menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
   /* Add this item.  */
   XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
@@ -7937,7 +7937,7 @@ menu_bar_item (key, item, dummy1, dummy2
   if (i == menu_bar_items_index)
     {
       /* If vector is too small, get a bigger one.  */
-      if (i + 4 > XVECTOR (menu_bar_items_vector)->size)
+      if (i + 4 > XVECTOR_SIZE (menu_bar_items_vector))
 	menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
       /* Add this item.  */
       XVECTOR (menu_bar_items_vector)->contents[i++] = key;
@@ -8573,7 +8573,7 @@ parse_tool_bar_item (key, item)
 	}
       else if (EQ (key, QCimage)
 	       && (CONSP (value)
-		   || (VECTORP (value) && XVECTOR (value)->size == 4)))
+		   || (VECTORP (value) && XVECTOR_SIZE (value) == 4)))
 	/* Value is either a single image specification or a vector
 	   of 4 such specifications for the different button states.  */
 	PROP (TOOL_BAR_ITEM_IMAGES) = value;
@@ -8634,10 +8634,10 @@ append_tool_bar_item ()
 
   /* Enlarge tool_bar_items_vector if necessary.  */
   if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS
-      >= XVECTOR (tool_bar_items_vector)->size)
+      >= XVECTOR_SIZE (tool_bar_items_vector))
     tool_bar_items_vector
       = larger_vector (tool_bar_items_vector,
-		       2 * XVECTOR (tool_bar_items_vector)->size, Qnil);
+		       2 * XVECTOR_SIZE (tool_bar_items_vector), Qnil);
 
   /* Append entries from tool_bar_item_properties to the end of
      tool_bar_items_vector.  */
@@ -8966,7 +8966,7 @@ read_char_minibuf_menu_prompt (commandfl
 		}
 
 	      /* Move past this element.  */
-	      if (idx >= 0 && idx + 1 >= XVECTOR (vector)->size)
+	      if (idx >= 0 && idx + 1 >= XVECTOR_SIZE (vector))
 		/* Handle reaching end of dense table.  */
 		idx = -1;
 	      if (idx >= 0)
@@ -10244,7 +10244,7 @@ read_key_sequence (keybuf, bufsize, prom
 	      /* Treat uppercase keys as shifted.  */
 	      || (INTEGERP (key)
 		  && (KEY_TO_CHAR (key)
-		      < XCHAR_TABLE (current_buffer->downcase_table)->size)
+		      < XCHAR_TABLE (current_buffer->downcase_table)->header.size)
 		  && UPPERCASEP (KEY_TO_CHAR (key))))
 	    {
 	      Lisp_Object new_key
@@ -10642,7 +10642,7 @@ give to the command you invoke, if it as
     this_single_command_key_start = 0;
 
     keys = XVECTOR (saved_keys)->contents;
-    for (i = 0; i < XVECTOR (saved_keys)->size; i++)
+    for (i = 0; i < XVECTOR_SIZE (saved_keys); i++)
       add_command_key (keys[i]);
 
     for (i = 0; i < SCHARS (function); i++)
@@ -10939,7 +10939,7 @@ KEEP-RECORD is non-nil.  */)
 
   if (NILP (keep_record))
     {
-      for (i = 0; i < XVECTOR (recent_keys)->size; ++i)
+      for (i = 0; i < XVECTOR_SIZE (recent_keys); ++i)
 	XVECTOR (recent_keys)->contents[i] = Qnil;
       total_keys = 0;
       recent_keys_index = 0;

=== modified file 'src/keymap.c'
--- src/keymap.c	2011-02-23 04:26:42 +0000
+++ src/keymap.c	2011-05-09 09:01:52 +0000
@@ -421,7 +421,7 @@ Return PARENT.  PARENT should be nil or 
 				XCDR (XCAR (list)));
 
       if (VECTORP (XCAR (list)))
-	for (i = 0; i < XVECTOR (XCAR (list))->size; i++)
+	for (i = 0; i < XVECTOR_SIZE (XCAR (list)); i++)
 	  if (CONSP (XVECTOR (XCAR (list))->contents[i]))
 	    fix_submap_inheritance (keymap, make_number (i),
 				    XVECTOR (XCAR (list))->contents[i]);
@@ -2337,7 +2337,7 @@ spaces are put between sequence elements
   if (STRINGP (list))
     size = SCHARS (list);
   else if (VECTORP (list))
-    size = XVECTOR (list)->size;
+    size = XVECTOR_SIZE (list);
   else if (CONSP (list))
     size = XINT (Flength (list));
   else
@@ -3257,7 +3257,7 @@ key             binding\n\
 
 	  elt = XCAR (list);
 	  prefix = Fcar (elt);
-	  if (XVECTOR (prefix)->size >= 1)
+	  if (XVECTOR_SIZE (prefix) >= 1)
 	    {
 	      tem = Faref (prefix, make_number (0));
 	      if (EQ (tem, Qmenu_bar))
@@ -3300,7 +3300,7 @@ key             binding\n\
 	  /* If the sequence by which we reach this keymap is zero-length,
 	     then the shadow map for this keymap is just SHADOW.  */
 	  if ((STRINGP (prefix) && SCHARS (prefix) == 0)
-	      || (VECTORP (prefix) && XVECTOR (prefix)->size == 0))
+	      || (VECTORP (prefix) && XVECTOR_SIZE (prefix) == 0))
 	    ;
 	  /* If the sequence by which we reach this keymap actually has
 	     some elements, then the sequence's definition in SHADOW is
@@ -3748,7 +3748,7 @@ describe_vector (vector, prefix, args, e
   if (CHAR_TABLE_P (vector))
     stop = MAX_5_BYTE_CHAR + 1, to = MAX_CHAR + 1;
   else
-    stop = to = XVECTOR (vector)->size;
+    stop = to = XVECTOR_SIZE (vector);
 
   for (i = from; ; i++)
     {

=== modified file 'src/lisp.h'
--- src/lisp.h	2011-01-23 22:38:13 +0000
+++ src/lisp.h	2011-05-09 09:48:57 +0000
@@ -550,6 +550,12 @@ extern Lisp_Object make_number P_ ((EMAC
 #define XSYMBOL(a) (eassert (SYMBOLP(a)),(struct Lisp_Symbol *) XPNTR(a))
 #define XFLOAT(a) (eassert (FLOATP(a)),(struct Lisp_Float *) XPNTR(a))
 
+/* Extract the size field of a vector or vector-like object.  */
+
+#define XVECTOR_SIZE(a) (XVECTOR (a)->header.size + 0)
+#define XVECTORLIKE_HEADER_SIZE(a) \
+  (((struct vectorlike_header *) XPNTR (a))->size + 0)
+
 /* Misc types.  */
 
 #define XMISC(a)   ((union Lisp_Misc *) XPNTR(a))
@@ -595,17 +601,24 @@ extern Lisp_Object make_number P_ ((EMAC
 
 /* Pseudovector types.  */
 
-#define XSETPVECTYPE(v,code) ((v)->size |= PSEUDOVECTOR_FLAG | (code))
+#define XSETPVECTYPE(v, code) XSETTYPED_PVECTYPE(v, header.size, code)
+#define XSETTYPED_PVECTYPE(v, size_member, code) \
+  ((v)->size_member |= PSEUDOVECTOR_FLAG | (code))
+#define XSETPVECTYPESIZE(v, code, sizeval) \
+  ((v)->header.size = PSEUDOVECTOR_FLAG | (code) | (sizeval))
 #define XSETPSEUDOVECTOR(a, b, code) \
+  XSETTYPED_PSEUDOVECTOR(a, b, XVECTORLIKE_HEADER_SIZE (a), code)
+#define XSETTYPED_PSEUDOVECTOR(a, b, size, code)			\
   (XSETVECTOR (a, b),							\
-   eassert ((XVECTOR (a)->size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK))	\
+   eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK))		\
 	    == (PSEUDOVECTOR_FLAG | (code))))
 #define XSETWINDOW_CONFIGURATION(a, b) \
   (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
 #define XSETPROCESS(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_PROCESS))
 #define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW))
 #define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL))
-#define XSETSUBR(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_SUBR))
+#define XSETSUBR(a, b) \
+  XSETTYPED_PSEUDOVECTOR (a, b, XSUBR (a)->size, PVEC_SUBR)
 #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED))
 #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER))
 #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE))
@@ -615,7 +628,7 @@ extern Lisp_Object make_number P_ ((EMAC
 /* Convenience macros for dealing with Lisp arrays.  */
 
 #define AREF(ARRAY, IDX)	XVECTOR ((ARRAY))->contents[IDX]
-#define ASIZE(ARRAY)		XVECTOR ((ARRAY))->size
+#define ASIZE(ARRAY)		XVECTOR_SIZE (ARRAY)
 /* The IDX==IDX tries to detect when the macro argument is side-effecting.  */
 #define ASET(ARRAY, IDX, VAL)	\
   (eassert ((IDX) == (IDX)),				\
@@ -780,11 +793,21 @@ struct Lisp_String
 #define OFFSETOF(type,field) \
   ((int)((char*)&((type*)0)->field - (char*)0))
 #endif
+/* Header of vector-like objects.  This type documents the constraints on
+   layout of vectors and pseudovectors, and helps optimizing compilers not get
+   fooled by Emacs's type punning.  */
+struct vectorlike_header
+  {
+    EMACS_UINT size;
+    union {
+      struct buffer *buffer;
+      struct Lisp_Vector *vector;
+    } next;
+  };
 
 struct Lisp_Vector
   {
-    EMACS_UINT size;
-    struct Lisp_Vector *next;
+    struct vectorlike_header header;
     Lisp_Object contents[1];
   };
 
@@ -820,7 +843,7 @@ struct Lisp_Vector
 /* Return the number of "extra" slots in the char table CT.  */
 
 #define CHAR_TABLE_EXTRA_SLOTS(CT)	\
-  (((CT)->size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
+  (((CT)->header.size & PSEUDOVECTOR_SIZE_MASK) - CHAR_TABLE_STANDARD_SLOTS)
 
 #ifdef __GNUC__
 
@@ -882,12 +905,11 @@ struct Lisp_Sub_Char_Table;
 
 struct Lisp_Char_Table
   {
-    /* This is the vector's size field, which also holds the
+    /* HEADER.SIZE is the vector's size field, which also holds the
        pseudovector type information.  It holds the size, too.
        The size counts the defalt, parent, purpose, ascii,
        contents, and extras slots.  */
-    EMACS_UINT size;
-    struct Lisp_Vector *next;
+    struct vectorlike_header header;
 
     /* This holds a default value,
        which is used whenever the value for a specific character is nil.  */
@@ -914,10 +936,9 @@ struct Lisp_Char_Table
 
 struct Lisp_Sub_Char_Table
   {
-    /* This is the vector's size field, which also holds the
+    /* HEADER.SIZE is the vector's size field, which also holds the
        pseudovector type information.  It holds the size, too.  */
-    EMACS_INT size;
-    struct Lisp_Vector *next;
+    struct vectorlike_header header;
 
     /* Depth of this sub char-table.  It should be 1, 2, or 3.  A sub
        char-table of depth 1 contains 16 elements, and each element
@@ -936,10 +957,9 @@ struct Lisp_Sub_Char_Table
 /* A boolvector is a kind of vectorlike, with contents are like a string.  */
 struct Lisp_Bool_Vector
   {
-    /* This is the vector's size field.  It doesn't have the real size,
+    /* HEADER.SIZE is the vector's size field.  It doesn't have the real size,
        just the subtype information.  */
-    EMACS_UINT vector_size;
-    struct Lisp_Vector *next;
+    struct vectorlike_header header;
     /* This is the size in bits.  */
     EMACS_UINT size;
     /* This contains the actual bits, packed into bytes.  */
@@ -952,7 +972,7 @@ struct Lisp_Bool_Vector
 
    This type is treated in most respects as a pseudovector,
    but since we never dynamically allocate or free them,
-   we don't need a next-vector field.  */
+   we don't need a struct vectorlike_header and its 'next' field.  */
 
 struct Lisp_Subr
   {
@@ -1066,9 +1086,8 @@ struct Lisp_Symbol
 
 struct Lisp_Hash_Table
 {
-  /* Vector fields.  The hash table code doesn't refer to these.  */
-  EMACS_UINT size;
-  struct Lisp_Vector *vec_next;
+  /* This is for Lisp; the hash table code does not refer to it.  */
+  struct vectorlike_header header;
 
   /* Function used to compare keys.  */
   Lisp_Object test;
@@ -1169,7 +1188,7 @@ struct Lisp_Hash_Table
 
 /* Value is the size of hash table H.  */
 
-#define HASH_TABLE_SIZE(H) XVECTOR ((H)->next)->size
+#define HASH_TABLE_SIZE(H) XVECTOR_SIZE ((H)->next)
 
 /* Default size for hash tables if not specified.  */
 
@@ -1551,7 +1570,7 @@ typedef struct {
 #define CONSP(x) (XTYPE ((x)) == Lisp_Cons)
 
 #define FLOATP(x) (XTYPE ((x)) == Lisp_Float)
-#define VECTORP(x)    (VECTORLIKEP (x) && !(XVECTOR (x)->size & PSEUDOVECTOR_FLAG))
+#define VECTORP(x)    (VECTORLIKEP (x) && !(XVECTOR_SIZE (x) & PSEUDOVECTOR_FLAG))
 #define OVERLAYP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Overlay)
 #define MARKERP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Marker)
 #define INTFWDP(x) (MISCP (x) && XMISCTYPE (x) == Lisp_Misc_Intfwd)
@@ -1566,8 +1585,14 @@ typedef struct {
 
 /* True if object X is a pseudovector whose code is CODE.  */
 #define PSEUDOVECTORP(x, code)					\
+  TYPED_PSEUDOVECTORP(x, vectorlike_header, code)
+
+/* True if object X, with internal type struct T *, is a pseudovector whose
+   code is CODE.  */
+#define TYPED_PSEUDOVECTORP(x, t, code)				\
   (VECTORLIKEP (x)						\
-   && (((XVECTOR (x)->size & (PSEUDOVECTOR_FLAG | (code))))	\
+   && (((((struct t *) XPNTR (x))->size				\
+	 & (PSEUDOVECTOR_FLAG | (code))))			\
        == (PSEUDOVECTOR_FLAG | (code))))
 
 /* Test for specific pseudovector types.  */
@@ -1575,7 +1600,7 @@ typedef struct {
 #define PROCESSP(x) PSEUDOVECTORP (x, PVEC_PROCESS)
 #define WINDOWP(x) PSEUDOVECTORP (x, PVEC_WINDOW)
 #define TERMINALP(x) PSEUDOVECTORP (x, PVEC_TERMINAL)
-#define SUBRP(x) PSEUDOVECTORP (x, PVEC_SUBR)
+#define SUBRP(x) TYPED_PSEUDOVECTORP (x, Lisp_Subr, PVEC_SUBR)
 #define COMPILEDP(x) PSEUDOVECTORP (x, PVEC_COMPILED)
 #define BUFFERP(x) PSEUDOVECTORP (x, PVEC_BUFFER)
 #define CHAR_TABLE_P(x) PSEUDOVECTORP (x, PVEC_CHAR_TABLE)

=== modified file 'src/lread.c'
--- src/lread.c	2011-03-19 16:42:53 +0000
+++ src/lread.c	2011-05-09 08:56:23 +0000
@@ -2433,7 +2433,7 @@ read1 (readcharfun, pch, first_in_list)
 	    {
 	      Lisp_Object tmp;
 	      tmp = read_vector (readcharfun, 0);
-	      if (XVECTOR (tmp)->size < CHAR_TABLE_STANDARD_SLOTS)
+	      if (XVECTOR_SIZE (tmp) < CHAR_TABLE_STANDARD_SLOTS)
 		error ("Invalid size char-table");
 	      XSETPVECTYPE (XVECTOR (tmp), PVEC_CHAR_TABLE);
 	      return tmp;
@@ -2452,7 +2452,7 @@ read1 (readcharfun, pch, first_in_list)
 		  depth = XINT (AREF (tmp, 0));
 		  if (depth < 1 || depth > 3)
 		    error ("Invalid depth in char-table");
-		  size = XVECTOR (tmp)->size - 2;
+		  size = XVECTOR_SIZE (tmp) - 2;
 		  if (chartab_size [depth] != size)
 		    error ("Invalid size char-table");
 		  XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE);
@@ -2503,7 +2503,7 @@ read1 (readcharfun, pch, first_in_list)
 	     build them using function calls.  */
 	  Lisp_Object tmp;
 	  tmp = read_vector (readcharfun, 1);
-	  return Fmake_byte_code (XVECTOR (tmp)->size,
+	  return Fmake_byte_code (XVECTOR_SIZE (tmp),
 				  XVECTOR (tmp)->contents);
 	}
       if (c == '(')
@@ -3332,7 +3332,7 @@ read_vector (readcharfun, bytecodeflag)
   len = Flength (tem);
   vector = (read_pure ? make_pure_vector (XINT (len)) : Fmake_vector (len, Qnil));
 
-  size = XVECTOR (vector)->size;
+  size = XVECTOR_SIZE (vector);
   ptr = XVECTOR (vector)->contents;
   for (i = 0; i < size; i++)
     {
@@ -3601,7 +3601,7 @@ Lisp_Object
 check_obarray (obarray)
      Lisp_Object obarray;
 {
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     {
       /* If Vobarray is now invalid, force it to be valid.  */
       if (EQ (Vobarray, obarray)) Vobarray = initial_obarray;
@@ -3622,7 +3622,7 @@ intern (str)
   Lisp_Object obarray;
 
   obarray = Vobarray;
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     obarray = check_obarray (obarray);
   tem = oblookup (obarray, str, len, len);
   if (SYMBOLP (tem))
@@ -3638,7 +3638,7 @@ intern_c_string (const char *str)
   Lisp_Object obarray;
 
   obarray = Vobarray;
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     obarray = check_obarray (obarray);
   tem = oblookup (obarray, str, len, len);
   if (SYMBOLP (tem))
@@ -3831,10 +3831,10 @@ oblookup (obarray, ptr, size, size_byte)
   Lisp_Object bucket, tem;
 
   if (!VECTORP (obarray)
-      || (obsize = XVECTOR (obarray)->size) == 0)
+      || (obsize = XVECTOR_SIZE (obarray)) == 0)
     {
       obarray = check_obarray (obarray);
-      obsize = XVECTOR (obarray)->size;
+      obsize = XVECTOR_SIZE (obarray);
     }
   /* This is sometimes needed in the middle of GC.  */
   obsize &= ~ARRAY_MARK_FLAG;
@@ -3887,7 +3887,7 @@ map_obarray (obarray, fn, arg)
   register int i;
   register Lisp_Object tail;
   CHECK_VECTOR (obarray);
-  for (i = XVECTOR (obarray)->size - 1; i >= 0; i--)
+  for (i = XVECTOR_SIZE (obarray) - 1; i >= 0; i--)
     {
       tail = XVECTOR (obarray)->contents[i];
       if (SYMBOLP (tail))
@@ -3974,7 +3974,7 @@ defsubr (sname)
 {
   Lisp_Object sym;
   sym = intern_c_string (sname->symbol_name);
-  XSETPVECTYPE (sname, PVEC_SUBR);
+  XSETTYPED_PVECTYPE (sname, size, PVEC_SUBR);
   XSETSUBR (XSYMBOL (sym)->function, sname);
 }
 

=== modified file 'src/minibuf.c'
--- src/minibuf.c	2011-01-02 23:50:46 +0000
+++ src/minibuf.c	2011-05-09 08:56:23 +0000
@@ -1326,7 +1326,7 @@ is used to further constrain the set of 
   if (type == obarray_table)
     {
       collection = check_obarray (collection);
-      obsize = XVECTOR (collection)->size;
+      obsize = XVECTOR_SIZE (collection);
       bucket = XVECTOR (collection)->contents[index];
     }
 
@@ -1590,7 +1590,7 @@ with a space are ignored unless STRING i
   if (type == 2)
     {
       collection = check_obarray (collection);
-      obsize = XVECTOR (collection)->size;
+      obsize = XVECTOR_SIZE (collection);
       bucket = XVECTOR (collection)->contents[index];
     }
 
@@ -1889,7 +1889,7 @@ the values STRING, PREDICATE and `lambda
 
       if (completion_ignore_case && !SYMBOLP (tem))
 	{
-	  for (i = XVECTOR (collection)->size - 1; i >= 0; i--)
+	  for (i = XVECTOR_SIZE (collection) - 1; i >= 0; i--)
 	    {
 	      tail = XVECTOR (collection)->contents[i];
 	      if (SYMBOLP (tail))

=== modified file 'src/print.c'
--- src/print.c	2011-01-02 23:50:46 +0000
+++ src/print.c	2011-05-09 09:25:50 +0000
@@ -1365,7 +1365,7 @@ print_preprocess (obj)
 	      /* Initialize the table.  */
 	      Vprint_number_table = Fmake_vector (make_number (40), Qnil);
 	    }
-	  else if (XVECTOR (Vprint_number_table)->size == print_number_index * 2)
+	  else if (XVECTOR_SIZE (Vprint_number_table) == print_number_index * 2)
 	    {
 	      /* Reallocate the table.  */
 	      int i = print_number_index * 4;
@@ -1411,7 +1411,7 @@ print_preprocess (obj)
 	  goto loop;
 
 	case Lisp_Vectorlike:
-	  size = XVECTOR (obj)->size;
+	  size = XVECTOR_SIZE (obj);
 	  if (size & PSEUDOVECTOR_FLAG)
 	    size &= PSEUDOVECTOR_SIZE_MASK;
 	  for (i = 0; i < size; i++)
@@ -2051,7 +2051,7 @@ print_object (obj, printcharfun, escapef
 	      strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun, 0);
 	      PRINTCHAR (' ');
 	      sprintf (buf, "%ld/%ld", (long) h->count,
-		       (long) XVECTOR (h->next)->size);
+		       (long) XVECTOR_SIZE (h->next));
 	      strout (buf, -1, -1, printcharfun, 0);
 	    }
 	  sprintf (buf, " 0x%lx", (unsigned long) h);
@@ -2062,7 +2062,7 @@ print_object (obj, printcharfun, escapef
 	    #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
 	  /* Always print the size. */
 	  sprintf (buf, "#s(hash-table size %ld",
-		   (long) XVECTOR (h->next)->size);
+		   (long) XVECTOR_SIZE (h->next));
 	  strout (buf, -1, -1, printcharfun, 0);
 
 	  if (!NILP (h->test))
@@ -2174,7 +2174,7 @@ print_object (obj, printcharfun, escapef
 	}
       else
 	{
-	  EMACS_INT size = XVECTOR (obj)->size;
+	  EMACS_INT size = XVECTOR_SIZE (obj);
 	  if (COMPILEDP (obj))
 	    {
 	      PRINTCHAR ('#');
@@ -2354,7 +2354,7 @@ print_object (obj, printcharfun, escapef
 	if (MISCP (obj))
 	  sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
 	else if (VECTORLIKEP (obj))
-	  sprintf (buf, "(PVEC 0x%08x)", (int) XVECTOR (obj)->size);
+	  sprintf (buf, "(PVEC 0x%08lx)", (unsigned long) XVECTOR_SIZE (obj));
 	else
 	  sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
 	strout (buf, -1, -1, printcharfun, 0);

=== modified file 'src/process.c'
--- src/process.c	2011-03-19 18:47:17 +0000
+++ src/process.c	2011-05-09 08:56:23 +0000
@@ -1277,25 +1277,26 @@ Returns nil if format of ADDRESS is inva
   if (VECTORP (address))  /* AF_INET or AF_INET6 */
     {
       register struct Lisp_Vector *p = XVECTOR (address);
+      EMACS_UINT size = p->header.size;
       Lisp_Object args[10];
       int nargs, i;
 
-      if (p->size == 4 || (p->size == 5 && !NILP (omit_port)))
+      if (size == 4 || (size == 5 && !NILP (omit_port)))
 	{
 	  args[0] = build_string ("%d.%d.%d.%d");
 	  nargs = 4;
 	}
-      else if (p->size == 5)
+      else if (size == 5)
 	{
 	  args[0] = build_string ("%d.%d.%d.%d:%d");
 	  nargs = 5;
 	}
-      else if (p->size == 8 || (p->size == 9 && !NILP (omit_port)))
+      else if (size == 8 || (size == 9 && !NILP (omit_port)))
 	{
 	  args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
 	  nargs = 8;
 	}
-      else if (p->size == 9)
+      else if (size == 9)
 	{
 	  args[0] = build_string ("[%x:%x:%x:%x:%x:%x:%x:%x]:%d");
 	  nargs = 9;
@@ -2477,13 +2478,13 @@ get_lisp_to_sockaddr_size (address, fami
   if (VECTORP (address))
     {
       p = XVECTOR (address);
-      if (p->size == 5)
+      if (p->header.size == 5)
 	{
 	  *familyp = AF_INET;
 	  return sizeof (struct sockaddr_in);
 	}
 #ifdef AF_INET6
-      else if (p->size == 9)
+      else if (p->header.size == 9)
 	{
 	  *familyp = AF_INET6;
 	  return sizeof (struct sockaddr_in6);
@@ -2502,7 +2503,7 @@ get_lisp_to_sockaddr_size (address, fami
       struct sockaddr *sa;
       *familyp = XINT (XCAR (address));
       p = XVECTOR (XCDR (address));
-      return p->size + sizeof (sa->sa_family);
+      return p->header.size + sizeof (sa->sa_family);
     }
   return 0;
 }

=== modified file 'src/process.h'
--- src/process.h	2011-01-02 23:50:46 +0000
+++ src/process.h	2011-05-09 09:48:57 +0000
@@ -27,13 +27,13 @@ along with GNU Emacs.  If not, see <http
 /* This structure records information about a subprocess
    or network connection.
 
-   Every field in this structure except for the first two
+   Every field in this structure except for the header
    must be a Lisp_Object, for GC's sake.  */
 
 struct Lisp_Process
   {
-    EMACS_UINT size;
-    struct Lisp_Vector *v_next;
+    struct vectorlike_header header;
+
     /* Name of subprocess terminal.  */
     Lisp_Object tty_name;
     /* Name of this process */

=== modified file 'src/syntax.c'
--- src/syntax.c	2011-01-02 23:50:46 +0000
+++ src/syntax.c	2011-05-09 08:56:23 +0000
@@ -956,7 +956,7 @@ text property.  */)
 	break;
       }
 
-  if (val < XVECTOR (Vsyntax_code_object)->size && NILP (match))
+  if (val < XVECTOR_SIZE (Vsyntax_code_object) && NILP (match))
     return XVECTOR (Vsyntax_code_object)->contents[val];
   else
     /* Since we can't use a shared object, let's make a new one.  */
@@ -3348,7 +3348,7 @@ init_syntax_once ()
 
   /* Create objects which can be shared among syntax tables.  */
   Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil);
-  for (i = 0; i < XVECTOR (Vsyntax_code_object)->size; i++)
+  for (i = 0; i < XVECTOR_SIZE (Vsyntax_code_object); i++)
     XVECTOR (Vsyntax_code_object)->contents[i]
       = Fcons (make_number (i), Qnil);
 

=== modified file 'src/termhooks.h'
--- src/termhooks.h	2011-01-02 23:50:46 +0000
+++ src/termhooks.h	2011-05-09 09:48:57 +0000
@@ -325,10 +325,8 @@ struct w32_display_info;
 /* Terminal-local parameters. */
 struct terminal
 {
-  /* The first two fields are really the header of a vector */
-  /* The terminal code does not refer to them.  */
-  EMACS_UINT size;
-  struct Lisp_Vector *vec_next;
+  /* This is for Lisp; the terminal code does not refer to it.  */
+  struct vectorlike_header header;
 
   /* Parameter alist of this terminal.  */
   Lisp_Object param_alist;

=== modified file 'src/w32font.c'
--- src/w32font.c	2011-01-02 23:50:46 +0000
+++ src/w32font.c	2011-05-09 08:56:24 +0000
@@ -173,7 +173,7 @@ intern_font_name (string)
 
   /* The following code is copied from the function intern (in lread.c).  */
   obarray = Vobarray;
-  if (!VECTORP (obarray) || XVECTOR (obarray)->size == 0)
+  if (!VECTORP (obarray) || XVECTOR_SIZE (obarray) == 0)
     obarray = check_obarray (obarray);
   tem = oblookup (obarray, SDATA (str), len, len);
   if (SYMBOLP (tem))

=== modified file 'src/w32menu.c'
--- src/w32menu.c	2011-01-02 23:50:46 +0000
+++ src/w32menu.c	2011-05-09 08:56:24 +0000
@@ -464,11 +464,11 @@ set_frame_menubar (f, first_time, deep_p
 
       menu_items = f->menu_bar_vector;
       menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
-      submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
-      submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
-      submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int));
+      submenu_start = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
+      submenu_end = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
+      submenu_n_panes = (int *) alloca (XVECTOR_SIZE (items) * sizeof (int));
       submenu_top_level_items
-	= (int *) alloca (XVECTOR (items)->size * sizeof (int *));
+	= (int *) alloca (XVECTOR_SIZE (items) * sizeof (int *));
       init_menu_items ();
       for (i = 0; i < ASIZE (items); i += 4)
 	{

=== modified file 'src/window.c'
--- src/window.c	2011-02-09 00:11:15 +0000
+++ src/window.c	2011-05-09 09:48:57 +0000
@@ -5931,8 +5931,7 @@ zero means top of window, negative means
 
 struct save_window_data
   {
-    EMACS_UINT size;
-    struct Lisp_Vector *next_from_Lisp_Vector_struct;
+    struct vectorlike_header header;
     Lisp_Object selected_frame;
     Lisp_Object current_window;
     Lisp_Object current_buffer;
@@ -5954,10 +5953,7 @@ struct save_window_data
 /* This is saved as a Lisp_Vector  */
 struct saved_window
 {
-  /* these first two must agree with struct Lisp_Vector in lisp.h */
-  EMACS_UINT size;
-  struct Lisp_Vector *next_from_Lisp_Vector_struct;
-
+  struct vectorlike_header header;
   Lisp_Object window;
   Lisp_Object buffer, start, pointm, mark;
   Lisp_Object left_col, top_line, total_cols, total_lines;
@@ -6141,7 +6137,7 @@ the return value is nil.  Otherwise the 
 	 dead.  */
       delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f)));
 
-      for (k = 0; k < saved_windows->size; k++)
+      for (k = 0; k < saved_windows->header.size; k++)
 	{
 	  p = SAVED_WINDOW_N (saved_windows, k);
 	  w = XWINDOW (p->window);
@@ -7078,10 +7074,10 @@ compare_window_configurations (c1, c2, i
     return 0;
 
   /* Verify that the two confis have the same number of windows.  */
-  if (sw1->size != sw2->size)
+  if (sw1->header.size != sw2->header.size)
     return 0;
 
-  for (i = 0; i < sw1->size; i++)
+  for (i = 0; i < sw1->header.size; i++)
     {
       struct saved_window *p1, *p2;
       int w1_is_current, w2_is_current;

=== modified file 'src/window.h'
--- src/window.h	2011-01-02 23:50:46 +0000
+++ src/window.h	2011-05-09 09:48:57 +0000
@@ -89,10 +89,9 @@ struct cursor_pos
 
 struct window
   {
-    /* The first two fields are really the header of a vector */
-    /* The window code does not refer to them.  */
-    EMACS_UINT size;
-    struct Lisp_Vector *vec_next;
+    /* This is for Lisp; the terminal code does not refer to it.  */
+    struct vectorlike_header header;
+
     /* The frame this window is on.  */
     Lisp_Object frame;
     /* t if this window is a minibuffer window.  */

=== modified file 'src/xdisp.c'
--- src/xdisp.c	2011-04-13 18:19:23 +0000
+++ src/xdisp.c	2011-05-09 08:56:24 +0000
@@ -3865,7 +3865,7 @@ setup_for_ellipsis (it, len)
     {
       struct Lisp_Vector *v = XVECTOR (DISP_INVIS_VECTOR (it->dp));
       it->dpvec = v->contents;
-      it->dpend = v->contents + v->size;
+      it->dpend = v->contents + v->header.size;
     }
   else
     {
@@ -5697,11 +5697,11 @@ get_next_display_element (it)
 	      /* Return the first character from the display table
 		 entry, if not empty.  If empty, don't display the
 		 current character.  */
-	      if (v->size)
+	      if (v->header.size)
 		{
 		  it->dpvec_char_len = it->len;
 		  it->dpvec = v->contents;
-		  it->dpend = v->contents + v->size;
+		  it->dpend = v->contents + v->header.size;
 		  it->current.dpvec_index = 0;
 		  it->dpvec_face_id = -1;
 		  it->saved_face_id = it->face_id;
@@ -17087,7 +17087,7 @@ display_menu_bar (w)
 
   /* Display all items of the menu bar.  */
   items = FRAME_MENU_BAR_ITEMS (it.f);
-  for (i = 0; i < XVECTOR (items)->size; i += 4)
+  for (i = 0; i < XVECTOR_SIZE (items); i += 4)
     {
       Lisp_Object string;
 
@@ -23086,7 +23086,7 @@ on_hot_spot_p (hot_spot, x, y)
 	{
 	  struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot));
 	  Lisp_Object *poly = v->contents;
-	  int n = v->size;
+	  int n = v->header.size;
 	  int i;
 	  int inside = 0;
 	  Lisp_Object lx, ly;

=== modified file 'src/xfaces.c'
--- src/xfaces.c	2011-03-17 15:44:02 +0000
+++ src/xfaces.c	2011-05-09 08:56:24 +0000
@@ -1966,7 +1966,7 @@ the WIDTH times as wide as FACE on FRAME
 
 #define LFACEP(LFACE)					\
      (VECTORP (LFACE)					\
-      && XVECTOR (LFACE)->size == LFACE_VECTOR_SIZE	\
+      && XVECTOR_SIZE (LFACE) == LFACE_VECTOR_SIZE	\
       && EQ (AREF (LFACE, 0), Qface))
 
 

=== modified file 'src/xmenu.c'
--- src/xmenu.c	2011-04-08 20:41:28 +0000
+++ src/xmenu.c	2011-05-09 08:56:24 +0000
@@ -1012,6 +1012,7 @@ set_frame_menubar (f, first_time, deep_p
       Lisp_Object *previous_items
 	= (Lisp_Object *) alloca (previous_menu_items_used
 				  * sizeof (Lisp_Object));
+      EMACS_UINT subitems;
 
       /* If we are making a new widget, its contents are empty,
 	 do always reinitialize them.  */
@@ -1056,13 +1057,14 @@ set_frame_menubar (f, first_time, deep_p
 
       menu_items = f->menu_bar_vector;
       menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
-      submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
-      submenu_end = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
-      submenu_n_panes = (int *) alloca (XVECTOR (items)->size * sizeof (int));
+      subitems = XVECTOR_SIZE (items) / 4;
+      submenu_start = (int *) alloca (subitems * sizeof (int *));
+      submenu_end = (int *) alloca (subitems * sizeof (int *));
+      submenu_n_panes = (int *) alloca (subitems * sizeof (int));
       submenu_top_level_items
-	= (int *) alloca (XVECTOR (items)->size * sizeof (int *));
+	= (int *) alloca (subitems * sizeof (int *));
       init_menu_items ();
-      for (i = 0; i < XVECTOR (items)->size; i += 4)
+      for (i = 0; i < subitems; i += 4)
 	{
 	  Lisp_Object key, string, maps;
 
@@ -1142,7 +1144,7 @@ set_frame_menubar (f, first_time, deep_p
       /* Now GC cannot happen during the lifetime of the widget_value,
 	 so it's safe to store data from a Lisp_String.  */
       wv = first_wv->contents;
-      for (i = 0; i < XVECTOR (items)->size; i += 4)
+      for (i = 0; i < XVECTOR_SIZE (items); i += 4)
 	{
 	  Lisp_Object string;
 	  string = XVECTOR (items)->contents[i + 1];
@@ -1168,7 +1170,7 @@ set_frame_menubar (f, first_time, deep_p
       first_wv = wv;
 
       items = FRAME_MENU_BAR_ITEMS (f);
-      for (i = 0; i < XVECTOR (items)->size; i += 4)
+      for (i = 0; i < XVECTOR_SIZE (items); i += 4)
 	{
 	  Lisp_Object string;
 

=== modified file 'src/xselect.c'
--- src/xselect.c	2011-04-08 20:41:28 +0000
+++ src/xselect.c	2011-05-09 08:56:24 +0000
@@ -486,7 +486,7 @@ x_get_local_selection (selection_symbol,
       int size;
       int i;
       pairs = XCDR (target_type);
-      size = XVECTOR (pairs)->size;
+      size = XVECTOR_SIZE (pairs);
       /* If the target is MULTIPLE, then target_type looks like
 	  (MULTIPLE . [[SELECTION1 TARGET1] [SELECTION2 TARGET2] ... ])
 	 We modify the second element of each pair in the vector and
@@ -1351,12 +1351,12 @@ copy_multiple_data (obj)
     return Fcons (XCAR (obj), copy_multiple_data (XCDR (obj)));
 
   CHECK_VECTOR (obj);
-  vec = Fmake_vector (size = XVECTOR (obj)->size, Qnil);
+  vec = Fmake_vector (size = XVECTOR_SIZE (obj), Qnil);
   for (i = 0; i < size; i++)
     {
       Lisp_Object vec2 = XVECTOR (obj)->contents [i];
       CHECK_VECTOR (vec2);
-      if (XVECTOR (vec2)->size != 2)
+      if (XVECTOR_SIZE (vec2) != 2)
 	/* ??? Confusing error message */
 	signal_error ("Vectors must be of length 2", vec2);
       XVECTOR (vec)->contents [i] = Fmake_vector (2, Qnil);
@@ -1996,7 +1996,7 @@ lisp_data_to_selection_data (display, ob
 	/* This vector is an ATOM set */
 	{
 	  if (NILP (type)) type = QATOM;
-	  *size_ret = XVECTOR (obj)->size;
+	  *size_ret = XVECTOR_SIZE (obj);
 	  *format_ret = 32;
 	  *data_ret = (unsigned char *) xmalloc ((*size_ret) * sizeof (Atom));
 	  for (i = 0; i < *size_ret; i++)
@@ -2011,7 +2011,7 @@ lisp_data_to_selection_data (display, ob
 	/* This vector is an ATOM_PAIR set */
 	{
 	  if (NILP (type)) type = QATOM_PAIR;
-	  *size_ret = XVECTOR (obj)->size;
+	  *size_ret = XVECTOR_SIZE (obj);
 	  *format_ret = 32;
 	  *data_ret = (unsigned char *)
 	    xmalloc ((*size_ret) * sizeof (Atom) * 2);
@@ -2019,7 +2019,7 @@ lisp_data_to_selection_data (display, ob
 	    if (VECTORP (XVECTOR (obj)->contents [i]))
 	      {
 		Lisp_Object pair = XVECTOR (obj)->contents [i];
-		if (XVECTOR (pair)->size != 2)
+		if (XVECTOR_SIZE (pair) != 2)
 		  signal_error (
 	"Elements of the vector must be vectors of exactly two elements",
 				pair);
@@ -2041,7 +2041,7 @@ lisp_data_to_selection_data (display, ob
 	/* This vector is an INTEGER set, or something like it */
 	{
           int data_size = 2;
-	  *size_ret = XVECTOR (obj)->size;
+	  *size_ret = XVECTOR_SIZE (obj);
 	  if (NILP (type)) type = QINTEGER;
 	  *format_ret = 16;
 	  for (i = 0; i < *size_ret; i++)
@@ -2095,7 +2095,7 @@ clean_local_selection_data (obj)
   if (VECTORP (obj))
     {
       int i;
-      int size = XVECTOR (obj)->size;
+      int size = XVECTOR_SIZE (obj);
       Lisp_Object copy;
       if (size == 1)
 	return clean_local_selection_data (XVECTOR (obj)->contents [0]);






^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-09 10:10                       ` Eli Zaretskii
@ 2011-05-09 15:09                         ` Sven Joachim
  2011-05-09 15:28                           ` Eli Zaretskii
  0 siblings, 1 reply; 20+ messages in thread
From: Sven Joachim @ 2011-05-09 15:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: eggert, 8623

On 2011-05-09 12:10 +0200, Eli Zaretskii wrote:

> I committed the resulting changes (after fixing a few gotchas) to the
> emacs-23 branch (revision 100571).  I only did some minimal testing,
> so please report any residual bugs.

The changes caused Emacs to crash right at the start, but Andreas has
already fixed this in revision 100572.  Now it seems to work fine.

> For now, I'm closing this bug report.

Thank you very much for delving into this problem.

Cheers,
       Sven





^ permalink raw reply	[flat|nested] 20+ messages in thread

* bug#8623: 23.3.50; (woman "git-remote") crashes
  2011-05-09 15:09                         ` Sven Joachim
@ 2011-05-09 15:28                           ` Eli Zaretskii
  0 siblings, 0 replies; 20+ messages in thread
From: Eli Zaretskii @ 2011-05-09 15:28 UTC (permalink / raw)
  To: Sven Joachim; +Cc: eggert, 8623

> From: Sven Joachim <svenjoac@gmx.de>
> Cc: eggert@cs.ucla.edu,  8623@debbugs.gnu.org
> Date: Mon, 09 May 2011 17:09:19 +0200
> 
> On 2011-05-09 12:10 +0200, Eli Zaretskii wrote:
> 
> > I committed the resulting changes (after fixing a few gotchas) to the
> > emacs-23 branch (revision 100571).  I only did some minimal testing,
> > so please report any residual bugs.
> 
> The changes caused Emacs to crash right at the start

Sorry, I could only test on a tty, not on X.





^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-05-09 15:28 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-05 20:09 bug#8623: 23.3.50; (woman "git-remote") crashes Sven Joachim
2011-05-05 20:44 ` Eli Zaretskii
2011-05-05 21:12   ` Sven Joachim
2011-05-06 10:15     ` Eli Zaretskii
2011-05-06 10:50       ` Sven Joachim
2011-05-06 12:36         ` Sven Joachim
2011-05-06 14:39           ` Stefan Monnier
2011-05-06 14:47             ` Paul Eggert
2011-05-08 11:50               ` Sven Joachim
2011-05-08 16:34                 ` Paul Eggert
2011-05-08 17:42                   ` Sven Joachim
2011-05-08 18:22                     ` Paul Eggert
2011-05-08 19:02                     ` Eli Zaretskii
2011-05-09 10:10                       ` Eli Zaretskii
2011-05-09 15:09                         ` Sven Joachim
2011-05-09 15:28                           ` Eli Zaretskii
2011-05-08 19:27                     ` Eli Zaretskii
2011-05-09 10:13                       ` Eli Zaretskii
2011-05-07 11:32             ` Richard Stallman
2011-05-06 14:37       ` Paul Eggert

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.