Bill Allombert on Sun, 27 Aug 2023 15:06:19 +0200
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: bug in simplify_shallow
|
- To: pari-dev@pari.math.u-bordeaux.fr
- Subject: Re: bug in simplify_shallow
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Sun, 27 Aug 2023 14:58:54 +0200
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1693141287; c=relaxed/relaxed; bh=gLstt416itYfagCJvi3c3ry8IYGj4ccFjBG2aezzSGg=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=kUTNL9gF4s4JyQT9VQLXCdNxcRROAitpEj4BFaL2gBdTb1lDe1Td8LoI9xEQzIBhrBNU+3GbDvS6a5Hke8R9NKaTycEgz3b1d8BMtODW7Q4CaKNEgdNsW70qAdnifHYzxJJbksGdK7/XJrInVpcdrqhkTVBgI5aGfzf34upxe4d6msEyNAkUKHythWz9VcVjssW1+8IY/Ve4rz+d6TkHT3jSp3f4ARzHyFDUKsfIDCvKoljs4ngec/ymsxbUuI+ZTUpI+Kce7QGGElRuIXDFuDoNSrq7sS3aNwvu5cPzRiZwc/e3bpEtF23rYBgn6tFJvOYdVhsiJ/FBG6S+dqWESM0YhZiCw/Pcs7uRYQgQs94x7LlxbKGw6HntbLAhA25ctajPKwNsZOnlO2fbetmYDnwmpnVeG6Ft3x5p9S6g/A56PCgV11xqVGbU+LfiN8+lC1BfU8hkRAgMLso16TJgB3A+zL+P4bJXIncaBzno/QhQiFtWe0Hs6/VHEkyE6Gu97Bkmzo0EdCU6DK8+nf3B7hyVfGllhh9qpL6qNIY10PKa+gDvBngBK0tLyDG+OSa5ZNfBGu6/Qis9TXCLV4oI3knQ1aDz0voMr2R95zRmtmekVvzfZHfgcWAjEgDBk34wvi+hjmUZWIRMTx68gG2UosLQqzCCHutXrZTaiBmg5cw=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1693141287; cv=none; b=WWgwADAYZe1RhGCcPLoEbeUCVBr6fECFLokljTSHZRfyR8RBcS0LUeJ1R4B+pbi49Fnu8J0HKRV7CyfG5J4JXltfarkzJEbYlJzyQHYlfnEKLkMLrqIi4bThgBssC3HvMhhXUo8u/5QbLUeXr5CzxBDfJ5NWKiX97V0Y8EVMp3rCC78tb4TBY/sASvPISlzJ2aPJRr2TEzv/9oL2IQsYzZFIkSvCBZVViiJLjlnUuJoA+sPRtRiGqshvxU0q+Ka1F5Au5ibsXKyRDP/qot8Ud0jfwZ6lZSQTqTnfutOyvA/kfJSPMQcmwZ9tPqvcRe91e/GDs1yoOu9xnnAZ9NZD4FNKCsUB1LtVtz9QEUslHj0DutrCGm3Ij4jMl3RqAwtXpW2pgIXmPDbsPTL8s1BcsIvxLL4oOTn/OUEPh7gV7rGO3NLjNTgxpH703+OV2x4FKLxrAlZwEkdA9cmlW/gj56K4BkN95bPv1MW9FAQ7wIxmNzkL7cHQNeB2W3GqLEc3gBwhS1B5WkJ2XHhggB4iybuEguywTiPx9Lf1hN4PFxWblLJ44TyZkCHbmZUEJK77UfWJdWNCLwpy7pVtB1pHgKYKZAtHiOr6Qn39cZ4OghaM6/h5Xxhq48+k28BVtUjS0TBzI1OEmT2rfyeui8mkd7YrDe9qPuGOrxESgMFjZQo=
- Authentication-results: smail; arc=none
- Delivery-date: Sun, 27 Aug 2023 15:06:19 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1693141287; bh=gLstt416itYfagCJvi3c3ry8IYGj4ccFjBG2aezzSGg=; h=Date:From:To:Subject:References:In-Reply-To:From; b=Uh3mb+jkwnFJthYODWtZ7BJUiUV3oDPWMB8XNm/ssqNBSCAkigSdNpt4QYGR/zLZX Oo0RP0O3Yk3k3gw7TZ2HPnURsn9EVrkN7r2+PUUtXok+LlQFV2KWhGi1yOskrRl12L CDHeBk14+Km1NZvV3gzaVz3I28szbI5XhcYBiUdn5Hob+N0hZvsUdJY9WuKww7W/Hk a33FbsNMFuh+6EAmzAEtYL0895VIG7IDaf617fWihsexpjvDb18Y70Grt05tEkRGLm Df4iU7zLkw7FIO3k7YQhP1JqBsY8CCCFOIZxIFzlfl737cwApIDMUEe6C4IqVO/ZGb Odwluo5zdQDzj48ZcAVRtM1nZdQEaTF2irRwqdKXMjYZzIvUYbCCSyHt7uVfJ8U/Kb 3YLpNho4XytPtR6QYongUVJm0solIuQIVRiq+1ZJZkRUjKSBHkfiP5Z3sxzEHCrCha YhAlM0vFqFNYSFSS2jtpK2Z6TgqKXuWcK7Xwc1VnyNEwSIApkgxZD/aIEbO3oUY8ua M46rEoF2sQHPg9fytnS1pnhChhyVdGYNO+iJuVw+QB3Ngu9gF6TGMjaMWVOBBXf6pw 27r17bBWnXrV1CmY8sTSqu8swke3DlH4c7OtHLTegSD4Xgn57phCqhZUw+08QoqCWP yqv7gJy/za1NHlONmwEyK3LQ=
- In-reply-to: <ZOoCXdx+VmSoRmML@math.u-bordeaux.fr>
- Mail-followup-to: pari-dev@pari.math.u-bordeaux.fr
- References: <1e144fa5-864d-450e-a109-1fac8300bf88@isolution.nl> <CANXmBjzx4t330CnCzz4TzMfPFVVYg+-T7iskqECzh_+_2G2ABw@mail.gmail.com> <ZOoCXdx+VmSoRmML@math.u-bordeaux.fr>
On Sat, Aug 26, 2023 at 03:47:09PM +0200, Karim Belabas wrote:
> You'll see it with valgrind.
>
> >From the GP code, I can guess what's happening: the lexical variable L
> will be destroyed (gunclone) when we leave the user function scope. But
> that user function still returns the return value of listput() which is
> the element stored in the list. The latter is a 'clone' (as all list
> entries), so supposedly safe. The lexical variable destructor breaks
> that asumption.
>
> I don't think the reference count machinery currently in place can
> deal with this. Adding a gcopy somewhere should be enough (but slow down
> all 'listput' operations...). Don't have time to delve in the C code
> right now to confirm this; I'll have a look later if Bill doesn't beat
> me to it :-)
Well, we could probably change listput (and listinsert) to use the prototype
code m. But to be honest I did not remember that listput returned x and it is
not explicitly documented, and the implementation is awkward.
(the simple, correct implementation would return gcopy of the original x, not a clone
of it).
Cheers,
Bill.