From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Tracking down assertion failure Date: Thu, 13 Mar 2008 00:06:15 +0200 Message-ID: References: Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org Content-Transfer-Encoding: 7BIT X-Trace: ger.gmane.org 1205359604 20169 80.91.229.12 (12 Mar 2008 22:06:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 12 Mar 2008 22:06:44 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 12 23:07:09 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JZZ6A-0003qt-FC for ged-emacs-devel@m.gmane.org; Wed, 12 Mar 2008 23:06:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZZ5c-0001El-11 for ged-emacs-devel@m.gmane.org; Wed, 12 Mar 2008 18:06:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JZZ5W-0001DU-Q8 for emacs-devel@gnu.org; Wed, 12 Mar 2008 18:06:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JZZ5U-0001Cq-IE for emacs-devel@gnu.org; Wed, 12 Mar 2008 18:06:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZZ5U-0001Cn-DP for emacs-devel@gnu.org; Wed, 12 Mar 2008 18:06:16 -0400 Original-Received: from mtaout2.012.net.il ([84.95.2.4]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JZZ5U-0001JQ-0A for emacs-devel@gnu.org; Wed, 12 Mar 2008 18:06:16 -0400 Original-Received: from HOME-C4E4A596F7 ([80.230.13.204]) by i_mtaout2.012.net.il (HyperSendmail v2004.12) with ESMTPA id <0JXN000V420UUFP1@i_mtaout2.012.net.il> for emacs-devel@gnu.org; Thu, 13 Mar 2008 00:19:43 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-kernel: by monty-python.gnu.org: Solaris 9.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:92324 Archived-At: > From: Stefan Monnier > Date: Wed, 12 Mar 2008 15:18:29 -0400 > > /* Skip from tlbufpos to PT and see where it is. Note that > PT may be in invisible text. If so, we will end at the > next visible position. */ > init_iterator (&it, w, CHARPOS (tlbufpos), BYTEPOS (tlbufpos), > NULL, DEFAULT_FACE_ID); > xassert (IT_BYTEPOS (it) == CHAR_TO_BYTE (IT_CHARPOS (it))); > > the problem is that as I keep adding such assertions earlier and earlier > in the code I seem to start hitting another problem: I'm not sure at > which point this condition should be true and and at which point it's OK > for it not to be true (because the charpos and bytepos recorded refer > to out-of-data data which will/should simply not be used). > > Can someone help me out? I may be forgetting something, but isn't the iterator moving by characters? It uses the pair IT_BYTEPOS (*it) += it->len; IT_CHARPOS (*it) += 1; to advance, so IT_BYTEPOS and IT_CHARPOS should always be in sync, right? Am I missing something?