GNU bug report logs - #76573
30.1; native compilation fails for record inside function

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Lin Jian <me@HIDDEN>; dated Tue, 25 Feb 2025 23:29:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 76573 <at> debbugs.gnu.org:


Received: (at 76573) by debbugs.gnu.org; 23 Apr 2025 12:10:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 23 08:10:33 2025
Received: from localhost ([127.0.0.1]:55243 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u7Yvx-0003HB-9T
	for submit <at> debbugs.gnu.org; Wed, 23 Apr 2025 08:10:33 -0400
Received: from mail.linj.tech ([5.255.109.209]:40950)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1u7Yvv-0003Fi-1s
 for 76573 <at> debbugs.gnu.org; Wed, 23 Apr 2025 08:10:31 -0400
From: Lin Jian <me@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linj.tech; s=mail;
 t=1745410228; bh=8aOdre2BURKNAgpVh2zEY9gt9nWhPPIlfIaFbIsKYls=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=LeXkgCuW6Gn0MitL666pdAawPy3Z6KTE74YwL0ZJ3bpVcnkzEVZq7Vz3lF6rNvsQV
 ytRRIEvscU+X4ZTVInRsxMY+uLthP0jdmFOdEzqOeO1DQ0pxIvcJNtNp7VhQN76jDp
 TbbM2716CJGOIZ6NBJzFfhoCo//ak2jKHUZGQLw6CNOH/mHt5G+SWeombTdLY6l0pr
 SfaDHYAYsTRYeNNTrgCYc++Pv13EnmXzKXhoegxpNaKsROjsT8MbziXPrJyBcdlJyT
 ABIn9WfiT3wTpEH6LssuX6uX6i8+NKwV6AyceB1jU05Av6ZtQM96tY1fedSMAmUl9A
 cRj1H1eOtBiXA==
To: Andrea Corallo <acorallo@HIDDEN>
Subject: Re: bug#76573: 30.1; native compilation fails for record inside
 function
In-Reply-To: <yp11pudutne.fsf@HIDDEN> (Andrea Corallo's message of
 "Mon, 31 Mar 2025 11:06:13 -0400")
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
Date: Wed, 23 Apr 2025 20:10:11 +0800
Message-ID: <874iyfoz8c.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 76573
Cc: Eli Zaretskii <eliz@HIDDEN>, 76573 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Sorry for the late reply.

Andrea Corallo <acorallo@HIDDEN> writes:

> the compiler is complaining because while the code is trying to create
> an object of type 'foo-r', this was actually never defined.
>
> Typically those user defined objects are defined using higher level
> constructs like 'cl-defstruct' which takes care of registering the
> definition into the global state (and defining the creator
> 'make-foo-r').
>
> Why is this code trying to create never defined kind of objects?  Isn't
> the case that the code in the file being compiled is missing some
> require to the definition?

I have no idea why some elisp packages use `record' directly instead of
some higher level functions like `cl-defstruct' since I am not the
author of those packages.

If using `record' directly is a user error, I would suggest:
1. mentioning it in the manual
2. and maybe also making the behavior consistent across different
`native-comp-speed' values.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76573; Package emacs. Full text available.

Message received at 76573 <at> debbugs.gnu.org:


Received: (at 76573) by debbugs.gnu.org; 13 Apr 2025 07:52:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Apr 13 03:52:53 2025
Received: from localhost ([127.0.0.1]:37941 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1u3s95-0008Vp-OI
	for submit <at> debbugs.gnu.org; Sun, 13 Apr 2025 03:52:53 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:41934)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1u3s8z-0008Tx-8W
 for 76573 <at> debbugs.gnu.org; Sun, 13 Apr 2025 03:52:48 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1u3s8t-0006Eg-0O; Sun, 13 Apr 2025 03:52:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Q+MR8BMq7M4zeFoP4xyLLp/jwaMH4N3ZFYem/3wdk4Q=; b=sKSnhB4hwTSU
 PN7D9IC07Hb4vyHFBUQKrk8SvObV+gb19dGDDBJawtiFGmD3EbDGJ4biJB9t8ColD7nVw2J4cD9fm
 R18fGq5iQzxQRw+AjG9NRlV9sY17AaqvNDz1a1jyAF8uF7DNsmNiAizxTw5c7Ggz2BQYZvimGUVkc
 paRVVwL2S0T1OPDaYVBPeoWxJp9RncrvXJ7wnPJVMjmQiywwAcgk7l5jlXfRqtglzXKHwTrDF77m0
 C7ZWGvvr0jdht6nHkK2rETdlywsKHGQOYfxN1B70ONWuXztYhUB3SWYvIPD0WaX1ZQ7+9SVOcgduw
 wALGqZnOcbpT+wW6SLyCHw==;
Date: Sun, 13 Apr 2025 10:52:35 +0300
Message-Id: <86friclcqk.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: me@HIDDEN, Andrea Corallo <acorallo@HIDDEN>
In-Reply-To: <yp11pudutne.fsf@HIDDEN> (message from Andrea Corallo
 on Mon, 31 Mar 2025 11:06:13 -0400)
Subject: Re: bug#76573: 30.1;
 native compilation fails for record inside function
References: <87o6ypa9k0.fsf@HIDDEN> <yp11pudutne.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76573
Cc: 76573 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ping!  Lin Jian, can you please answer Andrea's questions, so we could
decide how to proceed with this issue?

> Cc: 76573 <at> debbugs.gnu.org
> From: Andrea Corallo <acorallo@HIDDEN>
> Date: Mon, 31 Mar 2025 11:06:13 -0400
> 
> Lin Jian <me@HIDDEN> writes:
> 
> > Run the following shell command and you see the error.
> >
> >> emacs -Q --batch --eval="(native-compile (defun foo-f () (record 'foo-r)))"
> > Error: error (foo-f "Type foo-r missing from typeof-types!")
> >   signal(error (foo-f "Type foo-r missing from typeof-types!"))
> >   comp--native-compile(foo-f nil nil)
> >   native-compile(foo-f)
> >   eval((native-compile (defun foo-f nil (record 'foo-r))) t)
> >   command-line-1(("--eval=(native-compile (defun foo-f () (record 'foo-r)))"))
> >   command-line()
> >   normal-top-level()
> > peculiar error: "Type foo-r missing from typeof-types!"
> >
> > If you set `native-comp-speed' to -1, 0 or 1, there is no error.
> >> emacs -Q --batch --eval="(setopt native-comp-speed 1)"
> >> --eval="(native-compile (defun foo-f () (record 'foo-r)))"
> >
> > Emacs 30.0.93 and 30.1 have this bug, while Emacs 29.4 does not.
> >
> > Real world elisp packages triggering this bug are emacs-aio[1] and
> > el-easydraw[2].
> >
> > [1]: https://github.com/skeeto/emacs-aio/issues/31
> > [2]: https://github.com/misohena/el-easydraw/blob/f6b0f43138693b73cb65327d28bd2a4ee1b6caa7/edraw-path.el
> 
> Hi Lin,
> 
> the compiler is complaining because while the code is trying to create
> an object of type 'foo-r', this was actually never defined.
> 
> Typically those user defined objects are defined using higher level
> constructs like 'cl-defstruct' which takes care of registering the
> definition into the global state (and defining the creator
> 'make-foo-r').
> 
> Why is this code trying to create never defined kind of objects?  Isn't
> the case that the code in the file being compiled is missing some
> require to the definition?
> 
>   Andrea
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76573; Package emacs. Full text available.

Message received at 76573 <at> debbugs.gnu.org:


Received: (at 76573) by debbugs.gnu.org; 31 Mar 2025 15:06:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 31 11:06:26 2025
Received: from localhost ([127.0.0.1]:42421 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tzGiY-00027j-Ep
	for submit <at> debbugs.gnu.org; Mon, 31 Mar 2025 11:06:26 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:38274)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <acorallo@HIDDEN>) id 1tzGiV-000275-Dj
 for 76573 <at> debbugs.gnu.org; Mon, 31 Mar 2025 11:06:24 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <acorallo@HIDDEN>)
 id 1tzGiP-00046D-Fy; Mon, 31 Mar 2025 11:06:17 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=+M9cJxxoE1rMk/dJGYrGNfaGfxWQbgurPBdoPMG37tI=; b=jrBb3ryoWHihDqPbO468
 ikOffr396qppqFZBQ8fwgEYgQu0PmZlOJJQW43M3vZkPZdyRT+FHoxgf3BW8AEmA1lUrdQ/I0T5oK
 imJd3HZ9pWapmGUS0JZd3twZXFuWdLcH2bcKX+YGQd5UOIJ7ub6CZqHxBXXg75Ca4+u+IbQYb2oh8
 jqQyMsWyq3pKaGlb18wV+/ez7X6nCuSG3lF8sSxAXtGMF1BElQmxLzB/00/8PpASHXKdseu6Aufyg
 ewzYcAcPYsHf8cStQzm6rwHz6xkZps1pXOF1MplhZF/MrXsliqBfRQkJooD254Bv+At41lGj2zjtG
 WevLW/nQ5apBGA==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1tzGiL-0001BB-UF; Mon, 31 Mar 2025 11:06:15 -0400
From: Andrea Corallo <acorallo@HIDDEN>
To: Lin Jian <me@HIDDEN>
Subject: Re: bug#76573: 30.1; native compilation fails for record inside
 function
In-Reply-To: <87o6ypa9k0.fsf@HIDDEN> (Lin Jian's message of "Wed, 26 Feb
 2025 07:28:31 +0800")
References: <87o6ypa9k0.fsf@HIDDEN>
Date: Mon, 31 Mar 2025 11:06:13 -0400
Message-ID: <yp11pudutne.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76573
Cc: 76573 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Lin Jian <me@HIDDEN> writes:

> Run the following shell command and you see the error.
>
>> emacs -Q --batch --eval="(native-compile (defun foo-f () (record 'foo-r)))"
> Error: error (foo-f "Type foo-r missing from typeof-types!")
>   signal(error (foo-f "Type foo-r missing from typeof-types!"))
>   comp--native-compile(foo-f nil nil)
>   native-compile(foo-f)
>   eval((native-compile (defun foo-f nil (record 'foo-r))) t)
>   command-line-1(("--eval=(native-compile (defun foo-f () (record 'foo-r)))"))
>   command-line()
>   normal-top-level()
> peculiar error: "Type foo-r missing from typeof-types!"
>
> If you set `native-comp-speed' to -1, 0 or 1, there is no error.
>> emacs -Q --batch --eval="(setopt native-comp-speed 1)"
>> --eval="(native-compile (defun foo-f () (record 'foo-r)))"
>
> Emacs 30.0.93 and 30.1 have this bug, while Emacs 29.4 does not.
>
> Real world elisp packages triggering this bug are emacs-aio[1] and
> el-easydraw[2].
>
> [1]: https://github.com/skeeto/emacs-aio/issues/31
> [2]: https://github.com/misohena/el-easydraw/blob/f6b0f43138693b73cb65327d28bd2a4ee1b6caa7/edraw-path.el

Hi Lin,

the compiler is complaining because while the code is trying to create
an object of type 'foo-r', this was actually never defined.

Typically those user defined objects are defined using higher level
constructs like 'cl-defstruct' which takes care of registering the
definition into the global state (and defining the creator
'make-foo-r').

Why is this code trying to create never defined kind of objects?  Isn't
the case that the code in the file being compiled is missing some
require to the definition?

  Andrea




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76573; Package emacs. Full text available.

Message received at 76573 <at> debbugs.gnu.org:


Received: (at 76573) by debbugs.gnu.org; 9 Mar 2025 09:33:20 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 09 05:33:20 2025
Received: from localhost ([127.0.0.1]:58297 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1trD28-0004g7-8D
	for submit <at> debbugs.gnu.org; Sun, 09 Mar 2025 05:33:20 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:39470)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1trD26-0004fs-Lw
 for 76573 <at> debbugs.gnu.org; Sun, 09 Mar 2025 05:33:19 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1trD20-0002bQ-Um; Sun, 09 Mar 2025 05:33:12 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Jxm3DvyOEAcsLr7EpdtRCpTvKqbk2yfhYTY2G/5BcMA=; b=JOFq8VJOoHov
 cNI7T6odfLhJkImRtzlyrHibwYIH/2CVjFjSVx0NQLaMSXSSJ+tK5wRL1pDqI9X1K2uezb/Nw5xaO
 Y76mvb2iRVQ+Oav+58JGbmkWZPf5ePDK8i6sTo+0Xb+ah9eT1m6lBt3XgIPhgoF6BXOM7Vld/39RP
 UeVLDquBAMZxEEVjuIqgM6mLUs4zhn1F9GFItJjLGCtCzZMCLpZNiZ2QfEjeQCRyIiGMuPlPAXMs8
 qTHEGOVB6QY9eRjTeU2t+JyTPiC0G3ZKv+9nPyZHmW7BAl44Cw+ZFktboaUUg1smqBikYUXN7pTiw
 j10PwSbClVgpMchURC0nCg==;
Date: Sun, 09 Mar 2025 11:33:10 +0200
Message-Id: <86msduh7l5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Lin Jian <me@HIDDEN>, acorallo@HIDDEN
In-Reply-To: <87o6ypa9k0.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN)
Subject: Re: bug#76573: 30.1;
 native compilation fails for record inside function
References: <87o6ypa9k0.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 76573
Cc: 76573 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Andrea, could you please look into this?

> Cc: Andrea Corallo <acorallo@HIDDEN>
> Date: Wed, 26 Feb 2025 07:28:31 +0800
> From:  Lin Jian via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN>
> 
> 
> Run the following shell command and you see the error.
> 
> > emacs -Q --batch --eval="(native-compile (defun foo-f () (record 'foo-r)))"
> Error: error (foo-f "Type foo-r missing from typeof-types!")
>   signal(error (foo-f "Type foo-r missing from typeof-types!"))
>   comp--native-compile(foo-f nil nil)
>   native-compile(foo-f)
>   eval((native-compile (defun foo-f nil (record 'foo-r))) t)
>   command-line-1(("--eval=(native-compile (defun foo-f () (record 'foo-r)))"))
>   command-line()
>   normal-top-level()
> peculiar error: "Type foo-r missing from typeof-types!"
> 
> If you set `native-comp-speed' to -1, 0 or 1, there is no error.
> > emacs -Q --batch --eval="(setopt native-comp-speed 1)" --eval="(native-compile (defun foo-f () (record 'foo-r)))"
> 
> Emacs 30.0.93 and 30.1 have this bug, while Emacs 29.4 does not.
> 
> Real world elisp packages triggering this bug are emacs-aio[1] and
> el-easydraw[2].
> 
> [1]: https://github.com/skeeto/emacs-aio/issues/31
> [2]: https://github.com/misohena/el-easydraw/blob/f6b0f43138693b73cb65327d28bd2a4ee1b6caa7/edraw-path.el
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#76573; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Feb 2025 23:28:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 25 18:28:55 2025
Received: from localhost ([127.0.0.1]:49042 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tn4MB-00013t-1z
	for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 18:28:55 -0500
Received: from lists.gnu.org ([2001:470:142::17]:42026)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1tn4M8-00013Z-8L
 for submit <at> debbugs.gnu.org; Tue, 25 Feb 2025 18:28:52 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>) id 1tn4M2-00040w-Jq
 for bug-gnu-emacs@HIDDEN; Tue, 25 Feb 2025 18:28:46 -0500
Received: from mail.linj.tech ([5.255.109.209])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <me@HIDDEN>)
 id 1tn4M0-0007yG-Kn; Tue, 25 Feb 2025 18:28:46 -0500
From: Lin Jian <me@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linj.tech; s=mail;
 t=1740526120; bh=a8Bhy0NqskU4XxkYJvPI7L7ch3OBikca73DfhE0FsV4=;
 h=From:To:Subject:CC:Date;
 b=JMb5MgjCITBxaE0WaQOyPvpPI8gvwX1dObFSDNvWNlmKGO7Z9u3BxtGi1usRgN4Dg
 h0ro5UxenAotAq7LLRUZor/yFJGcna60LsB7ZqzuJB0yujwxPF/3dK5AUxx+c3t4/p
 GkrU5W7XPStCLKJn2cR2uIvyBcSfWkOkMd+cEL2+7/MA/bu/jPFZ8w2zaGGW6EkagO
 HyP2iblnb/o/uV1YSel2dGLMWoE7dOoNAGMhFGozwBg8i3FYVeQL6neky6bpD59Dfl
 iwzDLkzLNTKF3uCDwWu/N4eIOdXKrFls7AatX7HYSjdnSV0q0nAEcW++n42kPEO87d
 hdPksmoXho7ZA==
To: bug-gnu-emacs@HIDDEN
Subject: 30.1; native compilation fails for record inside function
X-Debbugs-Cc: 
Date: Wed, 26 Feb 2025 07:28:31 +0800
Message-ID: <87o6ypa9k0.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=5.255.109.209; envelope-from=me@HIDDEN;
 helo=mail.linj.tech
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
Cc: Andrea Corallo <acorallo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.1 (/)


Run the following shell command and you see the error.

> emacs -Q --batch --eval="(native-compile (defun foo-f () (record 'foo-r)))"
Error: error (foo-f "Type foo-r missing from typeof-types!")
  signal(error (foo-f "Type foo-r missing from typeof-types!"))
  comp--native-compile(foo-f nil nil)
  native-compile(foo-f)
  eval((native-compile (defun foo-f nil (record 'foo-r))) t)
  command-line-1(("--eval=(native-compile (defun foo-f () (record 'foo-r)))"))
  command-line()
  normal-top-level()
peculiar error: "Type foo-r missing from typeof-types!"

If you set `native-comp-speed' to -1, 0 or 1, there is no error.
> emacs -Q --batch --eval="(setopt native-comp-speed 1)" --eval="(native-compile (defun foo-f () (record 'foo-r)))"

Emacs 30.0.93 and 30.1 have this bug, while Emacs 29.4 does not.

Real world elisp packages triggering this bug are emacs-aio[1] and
el-easydraw[2].

[1]: https://github.com/skeeto/emacs-aio/issues/31
[2]: https://github.com/misohena/el-easydraw/blob/f6b0f43138693b73cb65327d28bd2a4ee1b6caa7/edraw-path.el




Acknowledgement sent to Lin Jian <me@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#76573; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 23 Apr 2025 12:15:05 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.