From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#17340: 24.4.50; emacs_backtrace.txt Date: Fri, 25 Apr 2014 12:40:08 -0400 Message-ID: References: <96b29810-0954-49f2-900f-dd5034e7a269@default> <83k3adpyzx.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1398743916 24025 80.91.229.3 (29 Apr 2014 03:58:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 29 Apr 2014 03:58:36 +0000 (UTC) Cc: Juanma Barranquero , 17340@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Apr 29 05:58:27 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WezBZ-0000V0-4z for geb-bug-gnu-emacs@m.gmane.org; Tue, 29 Apr 2014 05:58:25 +0200 Original-Received: from localhost ([::1]:46994 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WezBY-0007hD-SQ for geb-bug-gnu-emacs@m.gmane.org; Mon, 28 Apr 2014 23:58:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WezBO-0007dB-Vb for bug-gnu-emacs@gnu.org; Mon, 28 Apr 2014 23:58:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WezBE-0000cG-Cm for bug-gnu-emacs@gnu.org; Mon, 28 Apr 2014 23:58:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:55161) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WezBE-0000cC-93 for bug-gnu-emacs@gnu.org; Mon, 28 Apr 2014 23:58:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WezBD-0004gZ-GJ for bug-gnu-emacs@gnu.org; Mon, 28 Apr 2014 23:58:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Apr 2014 03:58:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17340 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: moreinfo Original-Received: via spool by 17340-submit@debbugs.gnu.org id=B17340.139874386417944 (code B ref 17340); Tue, 29 Apr 2014 03:58:03 +0000 Original-Received: (at 17340) by debbugs.gnu.org; 29 Apr 2014 03:57:44 +0000 Original-Received: from localhost ([127.0.0.1]:44270 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WezAt-0004fK-2f for submit@debbugs.gnu.org; Mon, 28 Apr 2014 23:57:44 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:54841) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WezAi-0004eJ-Oo for 17340@debbugs.gnu.org; Mon, 28 Apr 2014 23:57:33 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s3T3vRle015148; Mon, 28 Apr 2014 23:57:29 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 71FD066448; Fri, 25 Apr 2014 12:40:08 -0400 (EDT) In-Reply-To: <83k3adpyzx.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 25 Apr 2014 11:57:54 +0300") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4925=0 X-NAI-Spam-Version: 2.3.0.9378 : core <4925> : inlines <786> : streams <1168801> : uri <1743349> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:88382 Archived-At: >>>>> "Eli" == Eli Zaretskii writes: >> From: Juanma Barranquero >> Date: Fri, 25 Apr 2014 10:08:18 +0200 >> Cc: 17340@debbugs.gnu.org >> >> w32_backtrace at w32fns.c:8476 >> emacs_abort at w32fns.c:8508 >> terminate_due_to_signal at emacs.c:382 >> die at alloc.c:6955 >> XVECTOR at lisp.h:821 >> AREF at lisp.h:1308 >> coding_inherit_eol_type at coding.c:6031 >> Fchoose_write_coding_system at fileio.c:4632 >> write_region at fileio.c:4802 >> Fwrite_region at fileio.c:4676 >> auto_save_1 at fileio.c:5456 >> internal_condition_case at eval.c:1354 >> Fdo_auto_save at fileio.c:5666 >> shut_down_emacs at emacs.c:2033 >> terminate_due_to_signal at emacs.c:366 >> die at alloc.c:6955 >> rotate_left at intervals.c:393 <<<<<<<<<<<<<<<<<<<<<<< >> balance_an_interval at intervals.c:455 > This one's definitely related to Stefan's latest changes. Could you run with the patch below (and enable_checking, obviously), to try and catch the problem sooner? Stefan === modified file 'src/intervals.c' --- src/intervals.c 2014-04-19 18:13:26 +0000 +++ src/intervals.c 2014-04-25 16:38:44 +0000 @@ -110,13 +110,14 @@ set_string_intervals (parent, new); new->position = 0; } + eassert (LENGTH (new) > 0); set_interval_object (new, parent); return new; } -/* Make the interval TARGET have exactly the properties of SOURCE */ +/* Make the interval TARGET have exactly the properties of SOURCE. */ void copy_properties (register INTERVAL source, register INTERVAL target) @@ -176,10 +177,10 @@ Lisp_Object i1_cdr, i1_val; if (DEFAULT_INTERVAL_P (i0) && DEFAULT_INTERVAL_P (i1)) - return 1; + return true; if (DEFAULT_INTERVAL_P (i0) || DEFAULT_INTERVAL_P (i1)) - return 0; + return false; i0_cdr = i0->plist; i1_cdr = i1->plist; @@ -188,31 +189,31 @@ i0_sym = XCAR (i0_cdr); i0_cdr = XCDR (i0_cdr); if (!CONSP (i0_cdr)) - return 0; + return false; i1_val = i1->plist; while (CONSP (i1_val) && !EQ (XCAR (i1_val), i0_sym)) { i1_val = XCDR (i1_val); if (!CONSP (i1_val)) - return 0; + return false; i1_val = XCDR (i1_val); } /* i0 has something i1 doesn't. */ if (EQ (i1_val, Qnil)) - return 0; + return false; /* i0 and i1 both have sym, but it has different values in each. */ if (!CONSP (i1_val) || (i1_val = XCDR (i1_val), !CONSP (i1_val)) || !EQ (XCAR (i1_val), XCAR (i0_cdr))) - return 0; + return false; i0_cdr = XCDR (i0_cdr); i1_cdr = XCDR (i1_cdr); if (!CONSP (i1_cdr)) - return 0; + return false; i1_cdr = XCDR (i1_cdr); } @@ -339,10 +340,8 @@ ptrdiff_t old_total = A->total_length; eassert (old_total > 0); - eassert (old_total - > TOTAL_LENGTH (B) + TOTAL_LENGTH (A->right)); - eassert (TOTAL_LENGTH (B) - > TOTAL_LENGTH (B->left) + TOTAL_LENGTH (c)); + eassert (LENGTH (A) > 0); + eassert (LENGTH (B) > 0); /* Deal with any Parent of A; make it point to B. */ if (! ROOT_INTERVAL_P (A)) @@ -366,9 +365,11 @@ /* A's total length is decreased by the length of B and its left child. */ A->total_length -= B->total_length - TOTAL_LENGTH (c); eassert (TOTAL_LENGTH (A) > 0); + eassert (LENGTH (A) > 0); /* B must have the same total length of A. */ B->total_length = old_total; + eassert (LENGTH (B) > 0); return B; } @@ -390,10 +391,8 @@ ptrdiff_t old_total = A->total_length; eassert (old_total > 0); - eassert (old_total - > TOTAL_LENGTH (B) + TOTAL_LENGTH (A->left)); - eassert (TOTAL_LENGTH (B) - > TOTAL_LENGTH (B->right) + TOTAL_LENGTH (c)); + eassert (LENGTH (A) > 0); + eassert (LENGTH (B) > 0); /* Deal with any parent of A; make it point to B. */ if (! ROOT_INTERVAL_P (A)) @@ -417,9 +416,11 @@ /* A's total length is decreased by the length of B and its right child. */ A->total_length -= B->total_length - TOTAL_LENGTH (c); eassert (TOTAL_LENGTH (A) > 0); + eassert (LENGTH (A) > 0); /* B must have the same total length of A. */ B->total_length = old_total; + eassert (LENGTH (B) > 0); return B; } @@ -432,6 +433,9 @@ { register ptrdiff_t old_diff, new_diff; + eassert (LENGTH (i) > 0); + eassert (TOTAL_LENGTH (i) >= LENGTH (i)); + while (1) { old_diff = LEFT_TOTAL_LENGTH (i) - RIGHT_TOTAL_LENGTH (i); @@ -468,16 +472,16 @@ balance_possible_root_interval (INTERVAL interval) { Lisp_Object parent; - bool have_parent = 0; - - if (!INTERVAL_HAS_OBJECT (interval) && !INTERVAL_HAS_PARENT (interval)) - return interval; + bool have_parent = false; if (INTERVAL_HAS_OBJECT (interval)) { - have_parent = 1; + have_parent = true; GET_INTERVAL_OBJECT (parent, interval); } + else if (!INTERVAL_HAS_PARENT (interval)) + return interval; + interval = balance_an_interval (interval); if (have_parent) @@ -553,7 +557,7 @@ { set_interval_right (interval, new); new->total_length = new_length; - eassert (TOTAL_LENGTH (new) >= 0); + eassert (LENGTH (new) > 0); } else { @@ -562,7 +566,6 @@ set_interval_parent (interval->right, new); set_interval_right (interval, new); new->total_length = new_length + new->right->total_length; - eassert (TOTAL_LENGTH (new) >= 0); balance_an_interval (new); } @@ -598,7 +601,7 @@ { set_interval_left (interval, new); new->total_length = new_length; - eassert (TOTAL_LENGTH (new) >= 0); + eassert (LENGTH (new) > 0); } else { @@ -607,7 +610,6 @@ set_interval_parent (new->left, new); set_interval_left (interval, new); new->total_length = new_length + new->left->total_length; - eassert (TOTAL_LENGTH (new) >= 0); balance_an_interval (new); } @@ -796,7 +798,7 @@ { i->left->position = i->position - TOTAL_LENGTH (i->left) + LEFT_TOTAL_LENGTH (i->left); - i = i->left; /* Move to the left child */ + i = i->left; /* Move to the left child. */ } else if (NULL_PARENT (i)) error ("Point before start of properties"); @@ -811,7 +813,7 @@ { i->right->position = INTERVAL_LAST_POS (i) + LEFT_TOTAL_LENGTH (i->right); - i = i->right; /* Move to the right child */ + i = i->right; /* Move to the right child. */ } else if (NULL_PARENT (i)) error ("Point %"pD"d after end of properties", pos); @@ -958,7 +960,6 @@ for (temp = prev ? prev : i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) { temp->total_length += length; - eassert (TOTAL_LENGTH (temp) >= 0); temp = balance_possible_root_interval (temp); } @@ -1014,7 +1015,6 @@ for (temp = i; temp; temp = INTERVAL_PARENT_OR_NULL (temp)) { temp->total_length += length; - eassert (TOTAL_LENGTH (temp) >= 0); temp = balance_possible_root_interval (temp); } } @@ -1216,9 +1216,10 @@ this = this->left; this->total_length += migrate_amt; } - eassert (TOTAL_LENGTH (this) >= 0); set_interval_left (this, migrate); set_interval_parent (migrate, this); + eassert (LENGTH (this) > 0); + eassert (LENGTH (i->right) > 0); return i->right; } @@ -1298,7 +1299,7 @@ relative_position, amount); tree->total_length -= subtract; - eassert (TOTAL_LENGTH (tree) >= 0); + eassert (LENGTH (tree) > 0); return subtract; } /* Right branch. */ @@ -1313,7 +1314,7 @@ relative_position, amount); tree->total_length -= subtract; - eassert (TOTAL_LENGTH (tree) >= 0); + eassert (LENGTH (tree) > 0); return subtract; } /* Here -- this node. */ @@ -1328,7 +1329,7 @@ amount = my_amount; tree->total_length -= amount; - eassert (TOTAL_LENGTH (tree) >= 0); + eassert (LENGTH (tree) >= 0); if (LENGTH (tree) == 0) delete_interval (tree); @@ -1370,7 +1371,7 @@ if (ONLY_INTERVAL_P (tree)) { tree->total_length -= length; - eassert (TOTAL_LENGTH (tree) >= 0); + eassert (LENGTH (tree) > 0); return; } @@ -1430,12 +1431,12 @@ while (! NULL_LEFT_CHILD (successor)) { successor->total_length += absorb; - eassert (TOTAL_LENGTH (successor) >= 0); + eassert (LENGTH (successor) > 0); successor = successor->left; } successor->total_length += absorb; - eassert (TOTAL_LENGTH (successor) >= 0); + eassert (LENGTH (successor) > 0); delete_interval (i); return successor; } @@ -1457,7 +1458,7 @@ successor = INTERVAL_PARENT (successor); successor->total_length -= absorb; - eassert (TOTAL_LENGTH (successor) >= 0); + eassert (LENGTH (successor) > 0); } /* This must be the rightmost or last interval and cannot @@ -1486,12 +1487,12 @@ while (! NULL_RIGHT_CHILD (predecessor)) { predecessor->total_length += absorb; - eassert (TOTAL_LENGTH (predecessor) >= 0); + eassert (LENGTH (predecessor) > 0); predecessor = predecessor->right; } predecessor->total_length += absorb; - eassert (TOTAL_LENGTH (predecessor) >= 0); + eassert (LENGTH (predecessor) > 0); delete_interval (i); return predecessor; } @@ -1513,7 +1514,7 @@ predecessor = INTERVAL_PARENT (predecessor); predecessor->total_length -= absorb; - eassert (TOTAL_LENGTH (predecessor) >= 0); + eassert (LENGTH (predecessor) > 0); } /* This must be the leftmost or first interval and cannot @@ -1528,6 +1529,8 @@ { register INTERVAL target = make_interval (); + eassert (LENGTH (source) > 0); + target->total_length = source->total_length; target->position = source->position; @@ -1538,6 +1541,7 @@ if (! NULL_RIGHT_CHILD (source)) set_interval_right (target, reproduce_tree (source->right, target)); + eassert (LENGTH (target) > 0); return target; } @@ -1766,7 +1770,7 @@ if (! NILP (fallback)) return fallback; - /* Check for alternative properties */ + /* Check for alternative properties. */ tail = Fassq (prop, Vchar_property_alias_alist); if (! NILP (tail)) { @@ -2434,7 +2438,7 @@ end, end_byte); } - /* Rounding to char boundaries can theoretically ake this interval + /* Rounding to char boundaries can theoretically make this interval spurious. If so, delete one child, and copy its property list to this interval. */ if (LEFT_TOTAL_LENGTH (i) + RIGHT_TOTAL_LENGTH (i) >= TOTAL_LENGTH (i))