all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#48061: Unexpected result from a native-compiled function
@ 2021-04-27 14:49 Alan Mackenzie
  2021-04-27 17:20 ` Alan Mackenzie
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Mackenzie @ 2021-04-27 14:49 UTC (permalink / raw)
  To: 48061

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).





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

end of thread, other threads:[~2021-04-28  9:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-27 14:49 bug#48061: Unexpected result from a native-compiled function Alan Mackenzie
2021-04-27 17:20 ` Alan Mackenzie
2021-04-27 20:02   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-27 21:03     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-04-28  9:19       ` Alan Mackenzie

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.