GNU bug report logs - #67883
29.1.90; Native compiler hangs when compiling code with circular objects

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: hokomo <hokomo@HIDDEN>; Keywords: confirmed; merged with #57957; dated Mon, 18 Dec 2023 18:40:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

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


Received: (at 67883) by debbugs.gnu.org; 27 Dec 2023 19:54:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Dec 27 14:54:21 2023
Received: from localhost ([127.0.0.1]:37783 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rIZyu-0000RK-TG
	for submit <at> debbugs.gnu.org; Wed, 27 Dec 2023 14:54:21 -0500
Received: from layka.disroot.org ([178.21.23.139]:38916)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <hokomo@HIDDEN>) id 1rIZ3o-0004wE-2A
 for 67883 <at> debbugs.gnu.org; Wed, 27 Dec 2023 13:55:21 -0500
Received: from localhost (localhost [127.0.0.1])
 by disroot.org (Postfix) with ESMTP id A70C34151C;
 Wed, 27 Dec 2023 19:55:19 +0100 (CET)
X-Virus-Scanned: SPAM Filter at disroot.org
Received: from layka.disroot.org ([127.0.0.1])
 by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id Ej07nVpuTd5T; Wed, 27 Dec 2023 19:55:18 +0100 (CET)
References: <87a5q7bc2f.fsf@HIDDEN> <yp1v88uz7bh.fsf@HIDDEN>
 <yp1r0jiz5fb.fsf@HIDDEN>
 <CADwFkmm0oSEoju7WTkzhe2Sz8g9wyRQjTZN9Ua=FgJ7a0t_UkQ@HIDDEN>
 <yp1edf9z82c.fsf@HIDDEN>
 <CADwFkmnGoXJci_MHLJksVvrd0bu3qxu+YK4cPe3=ZjoFjTsMDQ@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail;
 t=1703703318; bh=Ngi69wJ3uT321exbJGnkjYLthTEEqYonYg60S+krMCE=;
 h=References:From:To:Cc:Subject:Date:In-reply-to;
 b=MW5D8oApd/60QwEJ8HQE7wyqJdvk7Oe00X1O82ogTwIyVuOMrgkREZ3JfpoeVeV5j
 Qi/OCWtZ8n5yVRUHCnrDGNi2X0TBQlFJeW0dYpDF5RyFFCavrS5i/btKGTqPsaj+VW
 64qx227O2Cg2JPscqtUtj9mOYWYp3wB8L8IYzO7ZwIDJ4uGn7x40iVCP4t2onk8KcZ
 uBF7tBoeBPsv6DhGDcHrOb5y8bAVy6rTRR77+jEr1Nm8YAKxVDTbYSM+t8/DETOzzj
 CnvJ2pJ6zxWC6VlBQBcT516aoYZeCnSYg0CUVIBLGLh1uA51trgFJBcF4HkUGxBCVz
 1GI3TJ270luMA==
From: hokomo <hokomo@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#67883: 29.1.90; Native compiler hangs when compiling code
 with circular objects
Date: Wed, 27 Dec 2023 19:48:23 +0100
In-reply-to: <CADwFkmnGoXJci_MHLJksVvrd0bu3qxu+YK4cPe3=ZjoFjTsMDQ@HIDDEN>
Message-ID: <87zfxvcw6j.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67883
X-Mailman-Approved-At: Wed, 27 Dec 2023 14:54:19 -0500
Cc: 67883 <at> debbugs.gnu.org, 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: -1.0 (-)


Merging the two indeed seems appropriate.

FWIW, I've read the other thread [1] and agree with Stefan's view 
that circular structures should be handled correctly by the 
compiler. I believe the example with `cycle-pure' shows that this 
is both useful and necessary, since circular structures can appear 
even without being directly present in the source code as 
literals, e.g. after compiler optimizations (which seems to be the 
case here, although I haven't confirmed it 100%).

- [1] <https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57957>

Kind regards,
hokomo




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#67883; Package emacs. Full text available.
Forcibly Merged 57957 67883. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at 67883) by debbugs.gnu.org; 26 Dec 2023 16:05:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 26 11:05:12 2023
Received: from localhost ([127.0.0.1]:54791 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rI9vb-0001ji-Cw
	for submit <at> debbugs.gnu.org; Tue, 26 Dec 2023 11:05:11 -0500
Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:46373)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1rI9vV-0001hv-Im
 for 67883 <at> debbugs.gnu.org; Tue, 26 Dec 2023 11:05:08 -0500
Received: by mail-wr1-x42b.google.com with SMTP id
 ffacd0b85a97d-33697e6fc4aso3210264f8f.1
 for <67883 <at> debbugs.gnu.org>; Tue, 26 Dec 2023 08:05:06 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1703606701; x=1704211501; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=lruqcY1h/sZ5iZOpridzwUMFdqm5R0PSiZYaU5yjFRc=;
 b=BFWF5i/qdbWGcqya6vGyILIde1e9DnoUfofFiCr+PKaGkYXpbB9V53TjhOGkaqbLJE
 YTOUVQmO/qpLjZWGCvfwnNYen1WMWpg1M+H8uC24Gw6OyC+3am9QEzGaUe/NW/zNpcGT
 pX6umoSUd3NAJFOQW1f+7LGOunurhsESxw0kpaiRtlZZog7mUrk3fSlrt8tPz+oAB5eR
 BOivA4VRu42AG7uVMmL9VA+jCOmxEuuEyr2S3W08Q195ZLH30PkIbYUYO/NK+ewcMJh+
 1vxkGFgMafo767Q4EIqwaF188mEf2Hp8yQy04kNJHg9AT64GfeP3Xxv6dOOF01wyxpkz
 f0KA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1703606701; x=1704211501;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=lruqcY1h/sZ5iZOpridzwUMFdqm5R0PSiZYaU5yjFRc=;
 b=UWR8LOAq1PoVHjU3sD9Y5AzWQD8h64P5t3uHaogSCl1lP9cG2xe6WShb1CGbu7CaEt
 zxaPrbFK1Q+XV9R7m8BuKlG9prbwirMt4qB7OGhmxZkew67EiNWn5xDM5nKlxxZiqrvO
 cIM0WdUKnnZFD9+Wrf3/aN3AHy4s5nrgtlE06aI8crSjiPR7k4SgAPUnTkdejBWSJcaR
 LtvN3Sj+U0ii4kfnJlPGBGklzuX7A3wbrFEVEygtUmp1x+BHHsAHjRoYl21FT+Q8SdQY
 PkJwGkqPPAtLguHZcOPLiq0q8a9aX2xpSoJNFgTxL2CrMapg/EdtZ0Vl1CeNs2+mrINN
 xw7g==
X-Gm-Message-State: AOJu0YwigSu+hNbIVw2GLAwzOVCMBLmIqOaAYeRXKk88poIF2xXsrWCV
 O9IHHXs5j2v3VRZxHnKDbWt+f90Zm2hsFzE+Q77IISvgsuk=
X-Google-Smtp-Source: AGHT+IE7IR5WymzfQ9SW27D/Su5X256ghgvLCQPmjMhPLQTK6zAMe1zkdPR2Ds/KUNOgd0MlFsBBBkEuRP2h8d0Jmbw=
X-Received: by 2002:aa7:cad2:0:b0:553:2e38:add0 with SMTP id
 l18-20020aa7cad2000000b005532e38add0mr3886011edt.39.1703604977170; Tue, 26
 Dec 2023 07:36:17 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Tue, 26 Dec 2023 09:36:16 -0600
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <yp1edf9z82c.fsf@HIDDEN>
References: <87a5q7bc2f.fsf@HIDDEN> <yp1v88uz7bh.fsf@HIDDEN>
 <yp1r0jiz5fb.fsf@HIDDEN>
 <CADwFkmm0oSEoju7WTkzhe2Sz8g9wyRQjTZN9Ua=FgJ7a0t_UkQ@HIDDEN>
 <yp1edf9z82c.fsf@HIDDEN>
MIME-Version: 1.0
Date: Tue, 26 Dec 2023 09:36:16 -0600
Message-ID: <CADwFkmnGoXJci_MHLJksVvrd0bu3qxu+YK4cPe3=ZjoFjTsMDQ@HIDDEN>
Subject: Re: bug#67883: 29.1.90; Native compiler hangs when compiling code
 with circular objects
To: Andrea Corallo <acorallo@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67883
Cc: 67883 <at> debbugs.gnu.org, hokomo@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: -1.0 (-)

forcemerge 57957 67883
thanks

Andrea Corallo <acorallo@HIDDEN> writes:

> Stefan Kangas <stefankangas@HIDDEN> writes:
>
>> Andrea Corallo <acorallo@HIDDEN> writes:
>>
>>> Okay I believe this most likely is a duplicate of bug#57957.
>>
>> Should the bugs be merged?
>
> Hi Stefan,
>
> yes I think so.
>
>   Andrea

Done.




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

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


Received: (at 67883) by debbugs.gnu.org; 26 Dec 2023 08:23:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 26 03:23:22 2023
Received: from localhost ([127.0.0.1]:55772 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rI2ig-0005wN-1c
	for submit <at> debbugs.gnu.org; Tue, 26 Dec 2023 03:23:22 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:50064)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acorallo@HIDDEN>) id 1rI2ie-0005w9-FJ
 for 67883 <at> debbugs.gnu.org; Tue, 26 Dec 2023 03:23:21 -0500
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 1rI2iR-0006zP-If; Tue, 26 Dec 2023 03:23:07 -0500
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=esMM+1Z771SjP7EbIsZcqudUqJJgJRcWY83hMvQqwFE=; b=htqjXc4w32Sj6VZRFAnI
 S8LmbhrBQUOW3FRn7DWQnvcNsCUhrVOKLoeSoKKs8RRsAjnXehg1aWp58gVNLd93Fjay9IWC1bGbP
 Zsy9eD3um1xmj9L4x9OhLPgr5YuMbZDMaWQWIm+8f8vrmhfHTVM+9XXuMS6HXHDHTmZ9nrB+0qUsf
 2TMU1S1oy7E66CAyP36E+G0WormcdhX286S+NhWdxx8z05kR7+UR6S+I4zaE79iXTUoIZGGExJeYA
 J5agAU7TdBb3rTjUqWH60mdvQfq9lk7mbiO/rYEd6GbqHH58/bdg2e2FqwTdEuviFHIbIZeYrgxBb
 uFXsTzpV+mJjOw==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1rI2iR-0004Qq-BW; Tue, 26 Dec 2023 03:23:07 -0500
From: Andrea Corallo <acorallo@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#67883: 29.1.90; Native compiler hangs when compiling code
 with circular objects
In-Reply-To: <CADwFkmm0oSEoju7WTkzhe2Sz8g9wyRQjTZN9Ua=FgJ7a0t_UkQ@HIDDEN>
 (Stefan Kangas's message of "Sun, 24 Dec 2023 11:41:12 -0800")
References: <87a5q7bc2f.fsf@HIDDEN> <yp1v88uz7bh.fsf@HIDDEN>
 <yp1r0jiz5fb.fsf@HIDDEN>
 <CADwFkmm0oSEoju7WTkzhe2Sz8g9wyRQjTZN9Ua=FgJ7a0t_UkQ@HIDDEN>
Date: Tue, 26 Dec 2023 03:23:07 -0500
Message-ID: <yp1edf9z82c.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: 67883
Cc: 67883 <at> debbugs.gnu.org, hokomo@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: -3.3 (---)

Stefan Kangas <stefankangas@HIDDEN> writes:

> Andrea Corallo <acorallo@HIDDEN> writes:
>
>> Okay I believe this most likely is a duplicate of bug#57957.
>
> Should the bugs be merged?

Hi Stefan,

yes I think so.

  Andrea




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

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


Received: (at 67883) by debbugs.gnu.org; 24 Dec 2023 19:41:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 24 14:41:28 2023
Received: from localhost ([127.0.0.1]:53577 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rHULn-00016h-Lf
	for submit <at> debbugs.gnu.org; Sun, 24 Dec 2023 14:41:27 -0500
Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:48396)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1rHULl-00016U-F7
 for 67883 <at> debbugs.gnu.org; Sun, 24 Dec 2023 14:41:26 -0500
Received: by mail-ed1-x533.google.com with SMTP id
 4fb4d7f45d1cf-554e902064aso21356a12.1
 for <67883 <at> debbugs.gnu.org>; Sun, 24 Dec 2023 11:41:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1703446873; x=1704051673; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=8jGFvLQygk8w4JV8ukNXvEJnhxQe+sWwZqgKnfhUU/E=;
 b=MpfobKCzNa5FBADvZEP/6jyTA5NqHDubBX5JdKzsOx1Nt6diDiPXAQ0liyBpYZAkKs
 N8He4GcEOWG7pGG6ocAJO3hToFF/k+yHPimAIs/7kDjg8gdYCXm5TI855ZSZYx4cG83q
 W2cXh9UthhLnX3RJuVddTZy2o2jlJPU3KoRdZ+BUMSHGYX5QZWHB7VSrX1+OW873PiLa
 OHv6tqN6Y45n3QZa2xaKlIhlC//WywgGcRprzBO+bmklLceSwjJxptgoB3ztaVmPATLy
 bSGb/Dkw+xiXt/zTiaj/OrUrB+H+9OrHlQ0u5ob05rJQyc2W6gNOescSF61+896Evi76
 2qJA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1703446873; x=1704051673;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=8jGFvLQygk8w4JV8ukNXvEJnhxQe+sWwZqgKnfhUU/E=;
 b=uGhEnyIx2/IzMcOZCs7A9ibBjZOODJ6fpEgTB6omtqIC6b6wq9k29dL8mcZoxs2ilc
 27sjKiWnEdZeJCBGI1JLA+fmZ4Zb0kcBVFjHyo4hRjnOehIAHDcvYnOL6NJWdDbhULlo
 8lVFkR0DDkvcEvZl6PdeC7ZCm5ii4ZvTaAIc8QWvVm2MCu3QZXF1zd0hUNuPgf5rtyz7
 QAHkbL4GuGAwGjVrTskIP7+BjCYoWoyTQJ93YvLapxvSe3cRD2Oof5EpB0XENVdmMpwT
 ZOFBlL/jrMKvooIlD+6t/60/BAxJZU4wzwCoGzrA1oQs4+pPNTIQegAfarJEvCoQ/gXI
 vV9g==
X-Gm-Message-State: AOJu0YxvQoyezq3tXJWCjsYYb2tqaOII5KudUBGTYuTiEmJX3TbcobxU
 yfmDK6DN310BPSYGYNJhss7/P3z2U80CxRoZHIk=
X-Google-Smtp-Source: AGHT+IEZrZn/pC+mLy2Mazxi4buRzdq8j9Gkgt9GxHJMjONZ4xUN4FbckreC6LMkvwRAcNCVrhzaZkPPBBXRVtZCfvw=
X-Received: by 2002:a50:ee09:0:b0:554:b760:ade4 with SMTP id
 g9-20020a50ee09000000b00554b760ade4mr1336091eds.76.1703446873301; Sun, 24 Dec
 2023 11:41:13 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sun, 24 Dec 2023 11:41:12 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <yp1r0jiz5fb.fsf@HIDDEN>
References: <87a5q7bc2f.fsf@HIDDEN> <yp1v88uz7bh.fsf@HIDDEN>
 <yp1r0jiz5fb.fsf@HIDDEN>
MIME-Version: 1.0
Date: Sun, 24 Dec 2023 11:41:12 -0800
Message-ID: <CADwFkmm0oSEoju7WTkzhe2Sz8g9wyRQjTZN9Ua=FgJ7a0t_UkQ@HIDDEN>
Subject: Re: bug#67883: 29.1.90; Native compiler hangs when compiling code
 with circular objects
To: Andrea Corallo <acorallo@HIDDEN>, 67883 <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 67883
Cc: hokomo@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: -1.0 (-)

Andrea Corallo <acorallo@HIDDEN> writes:

> Okay I believe this most likely is a duplicate of bug#57957.

Should the bugs be merged?




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

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


Received: (at 67883) by debbugs.gnu.org; 19 Dec 2023 13:29:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 19 08:29:55 2023
Received: from localhost ([127.0.0.1]:34627 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rFaAU-0003aL-U7
	for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 08:29:55 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:39948)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acorallo@HIDDEN>) id 1rFaAS-0003a9-Lk
 for 67883 <at> debbugs.gnu.org; Tue, 19 Dec 2023 08:29:53 -0500
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 1rFaAK-0005Wd-J7; Tue, 19 Dec 2023 08:29:44 -0500
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=5OsPfYrcoiFbYBwoZ0OJavvPoO86p4AkKO2z9AKDWjk=; b=CcaH2zRMGSV+zWdQKaxB
 D52Hc+iTGJMDbb/wJi3a+k/WvDsZgMqfPus266DLWd71dZD7bH8xImMSnkhiYp7C5QPVHgmwu4Efw
 LrDaHERCikSpSu0bJVZYZuPDvEi2aczPsro17+/sHi/td3AoVcb+eaDw9+XayF14/FMfDP3MMp4cr
 0s1viVy7vS2vd3BL3hQ55zccF3MZpvINygDr8nVCuMcBvNIIzmhFFQr/nuBTKuT/1Hlpr5ADEIAEn
 uv9wUn3GlWnoIn7g1YWmFVtEmQpsRvDEUClwNoGaP+fxpTo5TfFySPWeH3ZYpoRUSWIT0YLKwaGp/
 btj1eOC6jdCENg==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1rFaAK-0007jU-BI; Tue, 19 Dec 2023 08:29:44 -0500
From: Andrea Corallo <acorallo@HIDDEN>
To: 67883 <at> debbugs.gnu.org
Subject: Re: bug#67883: 29.1.90; Native compiler hangs when compiling code
 with circular objects
In-Reply-To: <yp1v88uz7bh.fsf@HIDDEN> (Andrea Corallo's message of
 "Tue, 19 Dec 2023 07:48:50 -0500")
References: <87a5q7bc2f.fsf@HIDDEN> <yp1v88uz7bh.fsf@HIDDEN>
Date: Tue, 19 Dec 2023 08:29:44 -0500
Message-ID: <yp1r0jiz5fb.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: 67883
Cc: hokomo@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: -3.3 (---)

Andrea Corallo <acorallo@HIDDEN> writes:

> hokomo via "Bug reports for GNU Emacs, the Swiss army knife of text
> editors" <bug-gnu-emacs@HIDDEN> writes:
>
>> Hello,
>>
>> The Emacs Lisp native compiler goes into an infinite loop when
>> compiling code that contains circular objects.
>>
>> For example, put the following into a file and use M-x
>> emacs-lisp-native-compile; it should hang:
>>
>>  (defun test1 ()
>>    '#1=(1 2 3 . #1#))
>>
>> It seems like this only happens for certain top-level forms, such as
>> `defun' (which may be expected behavior, due to the way the file
>> compiler processes top-level forms). For example, this doesn't hang:
>>
>>  (lambda ()
>>    '#1=(1 2 3 . #1#))
>>
>> Here's a more interesting example, which is how I stumbled upon this
>> issue in the first place:
>>
>>  (defun cycle-pure (list)
>>    (declare (pure t) (side-effect-free t))
>>    (let ((newlist (append list ())))
>>      (nconc newlist newlist)))
>>
>>  (defun test2 ()
>>    (cycle-pure '(1 2 3)))
>>
>> (The definition of `cycle-pure' is copied from the `-cycle' function
>> from the dash.el package.)
>>
>> If `cycle-pure' is not yet defined when compiling, the compiler
>> doesn't hang.
>>
>> However, if `cycle-pure' is defined (e.g. via M-x eval-defun), the
>> compiler hangs. This is weird because, unlike `test1' above, `test2'
>> doesn't contain a circular list itself; it only builds it at run-time.
>>
>> In contrast, this example doesn't hang, regardless of whether `cycle'
>> is defined or not (note the removed declarations):
>>
>>  (defun cycle (list)
>>    (let ((newlist (append list ())))
>>      (nconc newlist newlist)))
>>
>>  (defun test3 ()
>>    (cycle '(1 2 3)))
>>
>> My conjecture is that the `pure' and `side-effect-free' declarations
>> within `cycle-pure' (which I assume are picked up only once the
>> function definition is loaded) allow the compiler to do some constant
>> folding when it sees the expression `(cycle-pure '(1 2 3))'. This
>> results in the compiler manipulating a circular list at compile-time,
>> just like in `test1', and leads to a hang.
>>
>> Kind regards,
>> hokomo
>
> I'm pretty sure I've investigated this in the past.  IIRC this is due
> some cl- function hanging on a circular list.  Can't find the bug number
> ATM.
>
>   Andrea

Okay I believe this most likely is a duplicate of bug#57957.




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

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


Received: (at 67883) by debbugs.gnu.org; 19 Dec 2023 12:49:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 19 07:49:06 2023
Received: from localhost ([127.0.0.1]:34581 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rFZX0-0005ka-2z
	for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 07:49:06 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:59672)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acorallo@HIDDEN>) id 1rFZWy-0005k3-6B
 for 67883 <at> debbugs.gnu.org; Tue, 19 Dec 2023 07:49:04 -0500
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 1rFZWq-00069D-8U; Tue, 19 Dec 2023 07:48:56 -0500
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=2UEXrdnFwdVrOYqps1tFOVSIQV2VR2OYmi2JjbiEO1E=; b=Cqmhl7C/aqxTo7Ctlhw3
 VseKyPQxC6+AJaeuUJQDOr59iKtncuVGVlyJNM2YwDnGSf483i2WPDd71TmVx3bmKcemIlkro0UHf
 FRhfPw9tVX81qrzBvWjQTfoHaHxMAZxVODZdZjEtEvu0aM1FcM9gE7joKE159n6MiAa0MBGkps4Fo
 EQmU2zZvcszmg751oER0Orm7xJQx3w+Ni7xc1BXjCbsL+f20pMlhDi4BpFz5yj2+KiDUDpuvO3v8T
 XUU71uBrh0ZdcS8MMwstEgFC8+2RDrgkcDmTv8PBsYbP+Nw1hL1hbGsYQcG9ipTCsgv0rp1CUsLj3
 IEMwkKYsrtBLSQ==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1rFZWo-00019y-4m; Tue, 19 Dec 2023 07:48:55 -0500
From: Andrea Corallo <acorallo@HIDDEN>
To: hokomo via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#67883: 29.1.90; Native compiler hangs when compiling code
 with circular objects
In-Reply-To: <87a5q7bc2f.fsf@HIDDEN> (hokomo via's message of "Mon, 18
 Dec 2023 18:22:41 +0100")
References: <87a5q7bc2f.fsf@HIDDEN>
Date: Tue, 19 Dec 2023 07:48:50 -0500
Message-ID: <yp1v88uz7bh.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: 67883
Cc: 67883 <at> debbugs.gnu.org, hokomo <hokomo@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: -3.3 (---)

hokomo via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@HIDDEN> writes:

> Hello,
>
> The Emacs Lisp native compiler goes into an infinite loop when
> compiling code that contains circular objects.
>
> For example, put the following into a file and use M-x
> emacs-lisp-native-compile; it should hang:
>
>  (defun test1 ()
>    '#1=(1 2 3 . #1#))
>
> It seems like this only happens for certain top-level forms, such as
> `defun' (which may be expected behavior, due to the way the file
> compiler processes top-level forms). For example, this doesn't hang:
>
>  (lambda ()
>    '#1=(1 2 3 . #1#))
>
> Here's a more interesting example, which is how I stumbled upon this
> issue in the first place:
>
>  (defun cycle-pure (list)
>    (declare (pure t) (side-effect-free t))
>    (let ((newlist (append list ())))
>      (nconc newlist newlist)))
>
>  (defun test2 ()
>    (cycle-pure '(1 2 3)))
>
> (The definition of `cycle-pure' is copied from the `-cycle' function
> from the dash.el package.)
>
> If `cycle-pure' is not yet defined when compiling, the compiler
> doesn't hang.
>
> However, if `cycle-pure' is defined (e.g. via M-x eval-defun), the
> compiler hangs. This is weird because, unlike `test1' above, `test2'
> doesn't contain a circular list itself; it only builds it at run-time.
>
> In contrast, this example doesn't hang, regardless of whether `cycle'
> is defined or not (note the removed declarations):
>
>  (defun cycle (list)
>    (let ((newlist (append list ())))
>      (nconc newlist newlist)))
>
>  (defun test3 ()
>    (cycle '(1 2 3)))
>
> My conjecture is that the `pure' and `side-effect-free' declarations
> within `cycle-pure' (which I assume are picked up only once the
> function definition is loaded) allow the compiler to do some constant
> folding when it sees the expression `(cycle-pure '(1 2 3))'. This
> results in the compiler manipulating a circular list at compile-time,
> just like in `test1', and leads to a hang.
>
> Kind regards,
> hokomo

I'm pretty sure I've investigated this in the past.  IIRC this is due
some cl- function hanging on a circular list.  Can't find the bug number
ATM.

  Andrea




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

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


Received: (at submit) by debbugs.gnu.org; 19 Dec 2023 12:49:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 19 07:49:08 2023
Received: from localhost ([127.0.0.1]:34585 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rFZX2-0005kp-GY
	for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 07:49:08 -0500
Received: from lists.gnu.org ([2001:470:142::17]:56344)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acorallo@HIDDEN>) id 1rFZX1-0005k5-Oz
 for submit <at> debbugs.gnu.org; Tue, 19 Dec 2023 07:49:08 -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 <acorallo@HIDDEN>) id 1rFZWq-00079J-Jc
 for bug-gnu-emacs@HIDDEN; Tue, 19 Dec 2023 07:48:56 -0500
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 1rFZWq-00069D-8U; Tue, 19 Dec 2023 07:48:56 -0500
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=2UEXrdnFwdVrOYqps1tFOVSIQV2VR2OYmi2JjbiEO1E=; b=Cqmhl7C/aqxTo7Ctlhw3
 VseKyPQxC6+AJaeuUJQDOr59iKtncuVGVlyJNM2YwDnGSf483i2WPDd71TmVx3bmKcemIlkro0UHf
 FRhfPw9tVX81qrzBvWjQTfoHaHxMAZxVODZdZjEtEvu0aM1FcM9gE7joKE159n6MiAa0MBGkps4Fo
 EQmU2zZvcszmg751oER0Orm7xJQx3w+Ni7xc1BXjCbsL+f20pMlhDi4BpFz5yj2+KiDUDpuvO3v8T
 XUU71uBrh0ZdcS8MMwstEgFC8+2RDrgkcDmTv8PBsYbP+Nw1hL1hbGsYQcG9ipTCsgv0rp1CUsLj3
 IEMwkKYsrtBLSQ==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
 (envelope-from <acorallo@HIDDEN>)
 id 1rFZWo-00019y-4m; Tue, 19 Dec 2023 07:48:55 -0500
From: Andrea Corallo <acorallo@HIDDEN>
To: hokomo via "Bug reports for GNU Emacs, the Swiss army knife of text
 editors" <bug-gnu-emacs@HIDDEN>
Subject: Re: bug#67883: 29.1.90; Native compiler hangs when compiling code
 with circular objects
In-Reply-To: <87a5q7bc2f.fsf@HIDDEN> (hokomo via's message of "Mon, 18
 Dec 2023 18:22:41 +0100")
References: <87a5q7bc2f.fsf@HIDDEN>
Date: Tue, 19 Dec 2023 07:48:50 -0500
Message-ID: <yp1v88uz7bh.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: submit
Cc: 67883 <at> debbugs.gnu.org, hokomo <hokomo@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: -1.0 (-)

hokomo via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs@HIDDEN> writes:

> Hello,
>
> The Emacs Lisp native compiler goes into an infinite loop when
> compiling code that contains circular objects.
>
> For example, put the following into a file and use M-x
> emacs-lisp-native-compile; it should hang:
>
>  (defun test1 ()
>    '#1=(1 2 3 . #1#))
>
> It seems like this only happens for certain top-level forms, such as
> `defun' (which may be expected behavior, due to the way the file
> compiler processes top-level forms). For example, this doesn't hang:
>
>  (lambda ()
>    '#1=(1 2 3 . #1#))
>
> Here's a more interesting example, which is how I stumbled upon this
> issue in the first place:
>
>  (defun cycle-pure (list)
>    (declare (pure t) (side-effect-free t))
>    (let ((newlist (append list ())))
>      (nconc newlist newlist)))
>
>  (defun test2 ()
>    (cycle-pure '(1 2 3)))
>
> (The definition of `cycle-pure' is copied from the `-cycle' function
> from the dash.el package.)
>
> If `cycle-pure' is not yet defined when compiling, the compiler
> doesn't hang.
>
> However, if `cycle-pure' is defined (e.g. via M-x eval-defun), the
> compiler hangs. This is weird because, unlike `test1' above, `test2'
> doesn't contain a circular list itself; it only builds it at run-time.
>
> In contrast, this example doesn't hang, regardless of whether `cycle'
> is defined or not (note the removed declarations):
>
>  (defun cycle (list)
>    (let ((newlist (append list ())))
>      (nconc newlist newlist)))
>
>  (defun test3 ()
>    (cycle '(1 2 3)))
>
> My conjecture is that the `pure' and `side-effect-free' declarations
> within `cycle-pure' (which I assume are picked up only once the
> function definition is loaded) allow the compiler to do some constant
> folding when it sees the expression `(cycle-pure '(1 2 3))'. This
> results in the compiler manipulating a circular list at compile-time,
> just like in `test1', and leads to a hang.
>
> Kind regards,
> hokomo

I'm pretty sure I've investigated this in the past.  IIRC this is due
some cl- function hanging on a circular list.  Can't find the bug number
ATM.

  Andrea




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

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


Received: (at submit) by debbugs.gnu.org; 18 Dec 2023 18:39:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Dec 18 13:39:17 2023
Received: from localhost ([127.0.0.1]:33597 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rFIWK-000824-Pm
	for submit <at> debbugs.gnu.org; Mon, 18 Dec 2023 13:39:17 -0500
Received: from lists.gnu.org ([2001:470:142::17]:36934)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <hokomo@HIDDEN>) id 1rFILZ-0004wF-E2
 for submit <at> debbugs.gnu.org; Mon, 18 Dec 2023 13:28:09 -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 <hokomo@HIDDEN>)
 id 1rFILS-0008Jc-3c
 for bug-gnu-emacs@HIDDEN; Mon, 18 Dec 2023 13:28:02 -0500
Received: from layka.disroot.org ([178.21.23.139])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <hokomo@HIDDEN>)
 id 1rFILP-00048L-VM
 for bug-gnu-emacs@HIDDEN; Mon, 18 Dec 2023 13:28:01 -0500
Received: from localhost (localhost [127.0.0.1])
 by disroot.org (Postfix) with ESMTP id 2314A40C82
 for <bug-gnu-emacs@HIDDEN>; Mon, 18 Dec 2023 19:27:56 +0100 (CET)
X-Virus-Scanned: SPAM Filter at disroot.org
Received: from layka.disroot.org ([127.0.0.1])
 by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id Td8P6mSB7030 for <bug-gnu-emacs@HIDDEN>;
 Mon, 18 Dec 2023 19:27:54 +0100 (CET)
From: hokomo <hokomo@HIDDEN>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail;
 t=1702924074; bh=rZ/GJXtIUGXHvL9JXoOkNqDq2iAnL5DWrKP1wJRy3n0=;
 h=From:To:Subject:Date;
 b=GZn1MdInNtLJA6tUZ1VJyGazeIu70ORT/JV+Rp+nroa/yoAUC6UPgJYweQoSy+qI+
 t1V1Guk0U9y7NFb4wgzt31Z6DQXmY0raUdt2TeXTh1+H2IG7I35vQ6WB3J6zId10TX
 /9IVUSJv4HuocLIkr6jd787xtwFSdU8/VxMCQpnTqsgOKFomCar8EdyUA+p6biS2Yp
 rP8cPk3HvWOvsmeGSW85qBYR7MlAA/WbGwcU0CS6XE0fMw5Lk0SUCvs+5pYIzhLRoI
 NKXhn4zlumHE1/CLh8esM6iUKQ4uxEDdX1meFT2+GcE1zBYXMhX/UI/pnOAb+impDv
 /tRiQaQoUACCw==
To: bug-gnu-emacs@HIDDEN
Subject: 29.1.90; Native compiler hangs when compiling code with circular
 objects
Date: Mon, 18 Dec 2023 18:22:41 +0100
Message-ID: <87a5q7bc2f.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
Received-SPF: pass client-ip=178.21.23.139; envelope-from=hokomo@HIDDEN;
 helo=layka.disroot.org
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, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 18 Dec 2023 13:39:15 -0500
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 (/)

Hello,

The Emacs Lisp native compiler goes into an infinite loop when 
compiling code that contains circular objects.

For example, put the following into a file and use M-x 
emacs-lisp-native-compile; it should hang:

  (defun test1 ()
    '#1=(1 2 3 . #1#))

It seems like this only happens for certain top-level forms, such 
as `defun' (which may be expected behavior, due to the way the 
file compiler processes top-level forms). For example, this 
doesn't hang:

  (lambda ()
    '#1=(1 2 3 . #1#))

Here's a more interesting example, which is how I stumbled upon 
this issue in the first place:

  (defun cycle-pure (list)
    (declare (pure t) (side-effect-free t))
    (let ((newlist (append list ())))
      (nconc newlist newlist)))

  (defun test2 ()
    (cycle-pure '(1 2 3)))

(The definition of `cycle-pure' is copied from the `-cycle' 
function from the dash.el package.)

If `cycle-pure' is not yet defined when compiling, the compiler 
doesn't hang.

However, if `cycle-pure' is defined (e.g. via M-x eval-defun), the 
compiler hangs. This is weird because, unlike `test1' above, 
`test2' doesn't contain a circular list itself; it only builds it 
at run-time.

In contrast, this example doesn't hang, regardless of whether 
`cycle' is defined or not (note the removed declarations):

  (defun cycle (list)
    (let ((newlist (append list ())))
      (nconc newlist newlist)))

  (defun test3 ()
    (cycle '(1 2 3)))

My conjecture is that the `pure' and `side-effect-free' 
declarations within `cycle-pure' (which I assume are picked up 
only once the function definition is loaded) allow the compiler to 
do some constant folding when it sees the expression `(cycle-pure 
'(1 2 3))'. This results in the compiler manipulating a circular 
list at compile-time, just like in `test1', and leads to a hang.

Kind regards,
hokomo




Acknowledgement sent to hokomo <hokomo@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#67883; 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: Sat, 20 Jan 2024 12:30:02 UTC

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