all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrea Corallo <acorallo@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 67239@debbugs.gnu.org, Imran Khan <contact@imrankhan.live>
Subject: bug#67239: 30.0.50; 30.0.50: Error in nativecomp
Date: Sat, 02 Dec 2023 04:44:03 -0500	[thread overview]
Message-ID: <yp1ttp10wik.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <yp1cyw85cl6.fsf@fencepost.gnu.org> (Andrea Corallo's message of "Fri, 17 Nov 2023 15:50:13 -0500")

Andrea Corallo <acorallo@gnu.org> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Imran Khan <contact@imrankhan.live>
>>> Date: Fri, 17 Nov 2023 19:13:46 +0600
>>> 
>>> 
>>> Hello, I have come across a function that gives error when native
>>> compiled, but works fine when byte compiled.  The issue arose when using
>>> a third-party library (ts-format function in ts.el):
>>> 
>>> https://github.com/alphapapa/ts.el/blob/master/ts.el
>>> 
>>> But I have curved out the code so that you hopefully don't need to
>>> install that.
>>> 
>>> Reproduction under `emacs -Q`:
>>> 
>>> 1. First library "my-time.el" looks like:
>>> 
>>> ```
>>> ;;; -*- lexical-binding: t; -*-
>>> 
>>> (require 'cl-lib)
>>> 
>>> (cl-defstruct time
>>>   unix)
>>> 
>>> (defvar time-default-format "%Y-%m-%d %H:%M:%S %z"
>>>   "Default format for `time-format'.")
>>> 
>>> (defsubst time-format (&optional time-or-format-string time)
>>>   "Format timestamp with `format-time-string'.
>>> If TS-OR-FORMAT-STRING is a timestamp or nil, use the value of
>>> `time-default-format'.  If both TS-OR-FORMAT-STRING and TS are nil,
>>> use the current time."
>>>   (cl-etypecase time-or-format-string
>>>     (time (format-time-string time-default-format (time-unix time-or-format-string)))
>>>     (string (cl-etypecase time
>>>               (time (format-time-string time-or-format-string (time-unix time)))
>>>               (null (format-time-string time-or-format-string))))
>>>     (null (cl-etypecase time
>>>             (time (format-time-string time-default-format (time-unix time)))
>>>             (null (format-time-string time-default-format))))))
>>> 
>>> (provide 'my-time)
>>> ```
>>> 
>>> 2. Then there is my code "my-bug.el":
>>> 
>>> ```
>>> ;;; -*- lexical-binding: t -*-
>>> 
>>> (require 'my-time)
>>> 
>>> (defun my-bug ()
>>>   (let ((time (make-time :unix (time-convert (current-time) 'integer))))
>>>     ;; (message (time-format time)) ;; one argument works fine
>>>     (message (time-format "%F" time)) ;; but this says: (wrong-type-argument stringp time)
>>>     ))
>>> 
>>> (provide 'my-bug)
>>> ```
>>> 
>>> 3. When both of these are native compiled, doing `M-: (my-bug)` gives:
>>> ```
>>> Debugger entered--Lisp error: (wrong-type-argument stringp time)
>>>   my-bug()
>>>   eval-expression((my-bug) nil nil 127)
>>>   funcall-interactively(eval-expression (my-bug) nil nil 127)
>>>   command-execute(eval-expression)
>>> ```
>>> 
>>> 4. But if I C-M-x on `my-bug` manually, it works fine.
>>> 
>>> As far as I can tell, under 29.1 it worked fine under nativecomp too.
>>
>> Adding Andrea to the discussion.
>
> Thanks will look at.
>
>   Andrea

Quick update, didn't had much time and wans't trivial but I've a fix
that is under test.  I'll be pushing it when done.

Thanks

  Andrea





  reply	other threads:[~2023-12-02  9:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 13:13 bug#67239: 30.0.50; 30.0.50: Error in nativecomp Imran Khan
2023-11-17 15:02 ` Eli Zaretskii
2023-11-17 20:50   ` Andrea Corallo
2023-12-02  9:44     ` Andrea Corallo [this message]
2023-12-04 20:00       ` Andrea Corallo
2023-12-04 21:30         ` Imran Khan
2023-12-05  3:25           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yp1ttp10wik.fsf@fencepost.gnu.org \
    --to=acorallo@gnu.org \
    --cc=67239@debbugs.gnu.org \
    --cc=contact@imrankhan.live \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.