From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#48061: Unexpected result from a native-compiled function Date: Tue, 27 Apr 2021 14:49:31 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4414"; mail-complaints-to="usenet@ciao.gmane.io" To: 48061@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 27 16:50:24 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lbP2d-00012i-J5 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Apr 2021 16:50:23 +0200 Original-Received: from localhost ([::1]:52882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lbP2c-00081w-Ht for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Apr 2021 10:50:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbP2I-00081F-Ix for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2021 10:50:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lbP2H-0007dE-VM for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2021 10:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lbP2H-0002Yn-Tl for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2021 10:50:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Apr 2021 14:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48061 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16195349829808 (code B ref -1); Tue, 27 Apr 2021 14:50:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Apr 2021 14:49:42 +0000 Original-Received: from localhost ([127.0.0.1]:50504 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbP1y-0002Y8-39 for submit@debbugs.gnu.org; Tue, 27 Apr 2021 10:49:42 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:53676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lbP1w-0002Xz-DZ for submit@debbugs.gnu.org; Tue, 27 Apr 2021 10:49:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lbP1w-0007h1-5j for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2021 10:49:40 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:19197 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1lbP1u-0007JN-1g for bug-gnu-emacs@gnu.org; Tue, 27 Apr 2021 10:49:39 -0400 Original-Received: (qmail 55531 invoked by uid 3782); 27 Apr 2021 14:49:32 -0000 Original-Received: from acm.muc.de (p4fe15a60.dip0.t-ipconnect.de [79.225.90.96]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 27 Apr 2021 16:49:31 +0200 Original-Received: (qmail 4950 invoked by uid 1000); 27 Apr 2021 14:49:31 -0000 Content-Disposition: inline X-Submission-Agent: TMDA/1.3.x (Ph3nix) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205021 Archived-At: Hello, Emacs. In certain circumstances (see below for recipe), the natively compiled version of c-determine-limit-no-macro returns an invalid result, nil. In the same circumstances, the edebug instrumented version returns the correct result, a buffer position. So far I have tried M-x disassemble RET c-determine-limit-no-macro, but I wasn't able to follow the output (there were no symbols in the listing). Question: what else can I do to help isolate and fix this bug? Recipe for reproduction: In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.26, cairo version 1.16.0) of 2021-04-25 built on ACM Repository revision: 83a915d3dfafd5f3d737afe1e13b75e4dd3aef96 Repository branch: master System Description: Gentoo/Linux Configured using: 'configure --with-gif=no --with-tiff=no --with-gpm --with-native-compilation' (i) emacs -Q (ii) Make sure CC Mode is natively compiled and loaded into an Emacs session. (iii) Evaluate the following (an attempt to time CC Mode's indentation speed): (defmacro time-it (&rest forms) "Time the running of a sequence of forms using `float-time'. Call like this: \"M-: (time-it (foo ...) (bar ...) ...)\"." `(let ((start (float-time))) ,@forms (- (float-time) start))) (defun time-indent () (interactive) (save-excursion (goto-char (point-min)) (while (not (eobp)) (delete-horizontal-space) (beginning-of-line 2)) (goto-char (point-min)) (message "%s" (time-it (while (not (eobp)) (c-indent-line) (beginning-of-line 2)))))) (iv) Load src/minibuf.c into a buffer. (v) M-: (time-indent) RET This throws an error at line 606 in minibuf.c. point is at 16972, at BOL. (vi) With the current buffer minibuf.c, M-: (c-determine-limit-no-macro 16367 16972) RET. This returns the invalid result nil. This looks like a bug. (vii) Load lisp/progmodes/cc-engine.el into another buffer. Move to the definition of c-determine-limit-no-macro at line 5795. Instrument the function for edebug with C-u C-M-x. (viii) M-: (c-determine-limit-no-macro 16367 16972) RET, followed by the edebug command c. This indicates the expected result 16350, which is different from the nil returned in (vi). -- Alan Mackenzie (Nuremberg, Germany).