From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: Question about native compilation (bug?) Date: Wed, 26 Jul 2023 21:32:52 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27015"; mail-complaints-to="usenet@ciao.gmane.io" To: "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 26 23:48:04 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qOmMW-0006p7-Ja for ged-emacs-devel@m.gmane-mx.org; Wed, 26 Jul 2023 23:48:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qOm7z-0006Lf-HL; Wed, 26 Jul 2023 17:33:03 -0400 Original-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 ) id 1qOm7x-0006LG-4L for emacs-devel@gnu.org; Wed, 26 Jul 2023 17:33:01 -0400 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qOm7u-0000zM-7o for emacs-devel@gnu.org; Wed, 26 Jul 2023 17:33:00 -0400 Original-Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36QL0P5P018232 for ; Wed, 26 Jul 2023 21:32:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=corp-2023-03-30; bh=nY4UUYvh+fTQitCbjjgzJgopSOoSXrvvVB2fIVKJpYY=; b=Jdo+FqYTNXjbbyi8EfWACtEx55IYPVLPxv61vRYBZW9Phxr7M0O9o2uZdwprRB8rIPqs OgVRcoyrhdx6CQG6tmAISXgli9fwVnFWcRGZ+1icTIrIx1XM9XFm2RSRPepsgU97uIh3 kRkvJLYUKGLg6OkibQn1ETrjgCWXU34yWeNnkO7us2HYbOkKsi9lzlu7AphQloHr5Eub 41u9GvJmLCz1qfTqtqCgvv2dcZtiT/HH/4BM4fMikawV/kC3mSMDR+mECFMUffllL/+j G2Mqawm5Fg/K4+dc09JiIYNbSSEQm43oc9hqYsz7lgIuuyxXFvKZ7fQwN/STtwP/1OYp mQ== Original-Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3s06qu0fjd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 26 Jul 2023 21:32:56 +0000 Original-Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 36QKwYxo025271 for ; Wed, 26 Jul 2023 21:32:55 GMT Original-Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3s05j79eea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 26 Jul 2023 21:32:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RLDyWOCrvcK7xn2DNzJhBQDYkr+jsu2Iv2kRy/kGv55Srd7UW6DHOFZjSmzHhccrufJhUuCOh25Px+++CDL3mVen3Hv/S4Ot7iBNuk/AixlZbo453sXHu+j7+cOxPVCOXZOZQBfig+mqIpsMVHGM3M+URXOJoi3fnesMcC10qTnQ6cgWucuUTrew27HxZMDWit4HZSBLy/jG9NIlVx/2NHxUZBKsVJ2yKya3DmdNn16K1ogNDx+xjLndrKwK9+iet3DmWMJXYUFluO3mfmkoIcX/TboG6Ka+ezluW7nt5k7jQcpdZ4TQImUF/w7ieK1YF3/+oWOZwFAmuhieFrKKSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nY4UUYvh+fTQitCbjjgzJgopSOoSXrvvVB2fIVKJpYY=; b=RqUah6RFvcIoGW/FmwmdD7SlKTxybD9a8p+mlWUpa+ZOqvEVDS+td/Se+PY3CXcSsMMD/Q8SZmqonqrPWGJvh2MxknQ73zDiHIPsmAu+DYgXooVc0KiZccmtd9fkdBJ9L+66a1GcX5Ow+1Phtvqllb7A0FZm5DMK/JWADxWu0CBHhcs1LFe4gQSTeMccgzMI0BZC84lSmLRmA+L/k94kzCy+5dA37aD7r6cr9Vt4RM+9qLEnkVtykSin1MgyfhSXWKfF0YjI9/HLdgCbwF+4dnNJRfv1tHPfiOg1rSEQzvmbWQICUnTTK6dPXQrmSRdJ7fn8pNA9BrbxuXFWr5VDCw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nY4UUYvh+fTQitCbjjgzJgopSOoSXrvvVB2fIVKJpYY=; b=cJw/FtCcLY+EnGDnEDSYdWJtauQn5iBEbTZoL8/72pkRQhcQ09wsPEgr/cVAEjpdxbKeCEF0HVvFfGZWuAAdedeEIY3NJWCIx2uLwVMSByRCVW49dc4cqor4Rjxz9rphMMH45/ki74Gj2/jodxIY4QDoPikeeer4CI07L3ugKjs= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by PH0PR10MB5401.namprd10.prod.outlook.com (2603:10b6:510:e8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Wed, 26 Jul 2023 21:32:53 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::4af:4ff4:1ede:aff0]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::4af:4ff4:1ede:aff0%5]) with mapi id 15.20.6609.032; Wed, 26 Jul 2023 21:32:53 +0000 Thread-Topic: Question about native compilation (bug?) Thread-Index: AdnAB0+p/UhAW1AZR5iYUOzVAT/wow== Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|PH0PR10MB5401:EE_ x-ms-office365-filtering-correlation-id: 0ec92903-0871-416a-36f5-08db8e1fde6c x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 7vBbTHY2SGPoZlsT3wWhzAOvDI48u6I3CKola7KoxBPIddw16KHoi5++9xdIvtWeylea/5vuvktlCOaqLGbGWKVJ6Aa3TmJ3joPzQ9D+MGV+R9vIkuplsn23NsDZalk0LnuwQRitiV9bBxkbaRXR5jXCKpqj3NosPMrWeMaYfbZcLt1I1feu0/n4wKoWLDeVBc8IqCMPemF2uy5Z4dld2vaPgotR/9+a4HPqtwrgqzXqt8Q/UvOCZZU24sdRSUbU9lRzxBWnL5W2PZmpbKUIStjTC6dONxbL905y9ijOti6d9ujjo7zuKJ+xi79PifAFOgvEBRgNpQTIibNU/3E32NuFFAGGLx7QXrlnFujVZfMv9r4b2SHTMZE0vZ5/uC4Gx0HcsRyulLteOnjeYVZN9L84wOXaYB9eToGMuvwAcvikwNDh3rDvfk7CaTe1Wyj1a5X/c8eM8RdnHCq3cNSUA9wJJILuosVrg6XgDJDvAgVcxNXKWfgXlCw4wx3eIfr4P27NVIfOrunj9+LF4IuiyF7biiQSYWJfRdfuA5/x4nADsMGG2yEWzS2luCt4Avx+szOo589odI+WFO40u3yJzGvD8i3Onyo0Ucm+xKxjoSq5mOb3Cq15IJnEWwggfL4g x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(376002)(366004)(136003)(346002)(396003)(39860400002)(451199021)(83380400001)(44832011)(52536014)(5660300002)(2906002)(7696005)(55016003)(38070700005)(71200400001)(26005)(9686003)(86362001)(478600001)(38100700002)(41300700001)(316002)(186003)(66476007)(66946007)(66556008)(66446008)(76116006)(64756008)(6506007)(122000001)(33656002)(8676002)(8936002)(6916009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?mfarIsNJCRHymj4P9wGen2JQjZB/gZX/IUsbp/mKgmH/UpYYit5VC3dga0?= =?iso-8859-1?Q?UIePNx158YJLqeaHDX6mj/izp7wzMlurUA3qQPajqhIQc33j3l/KPaLakc?= =?iso-8859-1?Q?YDsthtBtCiaEZKvE3kYqfrgVo4hZQADeJ24VgcTZUjzQMt0cRhbGNAFAOv?= =?iso-8859-1?Q?HSkvVvl/jcd9wF9pjGHZDAKf0Wb7LaDAGkboZuHt5BBjZCdEu3W7Ocx/mK?= =?iso-8859-1?Q?MWDXWaYrGS9zeTCPZDHm+pMqx5Q8z0CQWrDo0lOLGNro9c3850P32okXFo?= =?iso-8859-1?Q?hDhe01Qph5Bo1S3VgRzuh+6pC2dGnOcytlVRSeOpFukDJh11tcKIe7AYyl?= =?iso-8859-1?Q?O7x+S3JtYwgvzl9y7OoyXlJ/75TQS9VXbhb/ncM5nL8rRYfLnjIzlqMdIe?= =?iso-8859-1?Q?1k8PjntxkeP7r727pleJgzyd85reVr3qtiW0daH4qTmlLIc7z2z7o8AJKE?= =?iso-8859-1?Q?9B6816Cb/1fg4h8wRZ8zqg9+ZPiiM8HY6F3/Z6FoYEEJIXREcz97gJB6Rw?= =?iso-8859-1?Q?BODwNE5tUMNj3lVTbd39whGJGxplPP+tqoF03dUrLOl3mibkdUz/qsgtw7?= =?iso-8859-1?Q?nqAtjtSi/7LaEwhozy97JeFJKb39DGF4cr66DYMIUiQB9t0Hw1jCe2wuVj?= =?iso-8859-1?Q? X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: K8DfZ+U5jJBAlZ1ikM83ZG20QIMEvOIU7xNr9/q55B4/veUSs9ALHew6AiQCPi1dJ2U9RwuY4j8yldoms8D8NFOf+q4NuVjvsq4fINDSRozIzVoo/Wn5xIzWUCXCFogo+gjRVSztYM3d5dSiNTKp1H7eb02vsSB4vD6oc9thVk4xtqA6JI8NyuhUX9olC/TxOCdm4LBAIC6zD9XHIixJaG6Z8HGN/hT69qqmGJIsFR05m0cNlJGrx9bnlxpAd0oRJvFsDyqxDEi6D4Bt375xqW2S6S7meQ22HRhnz0y3/GBa6ngBncspvQ5UWCfbIpOx30OXCdIQEOCeA+GcoWER5O0G8NkZ6ty98zABj4Hxe6MmWe3qKoq2Ajt++IrSF6e+wy+ww+nO6povHgYDlJ/8yCySUPjpDeSxW+Rc+xSeM9xdoHuy468HkgG04H1qpt3q5xzyJ12XW01+0C6kGjKnuSTIQC6148jGsUIWoefAf3Hywl3gbfIGPhVhsKJDKnq6Wy2Kzprr4Z7WFxdy1v0lzE7/+VWq6bEr6yTXhMbH+dGwIqBmCLfQbmuSYQ0XCU0VavK/fYoQ9BZ6UWAdAXiNiTH+ssOEi4Y1oc0FrEIIuEOw8IcgqgFFXpEU5WU6QMg51S/F++zcLMg+gwplsolbLQxmXavjRgSSfeACWIdsWY2QRmXDTogwJX8BuScsbntG14CQN//oAdUyOhjjKlkg/x/VKd2nom1vpzoYITgadmndsC jHGyXPB/nA9BJz+vno X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ec92903-0871-416a-36f5-08db8e1fde6c X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jul 2023 21:32:52.9651 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: RKXITB/11dEzOvEYtz83aSJVGaPJCVWpsaCoi7EUrPSGJTZfilZV0FBWTWl3D5B/Slv1NAwYhzQetu91CA+3nw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB5401 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-26_08,2023-07-26_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxlogscore=999 adultscore=0 mlxscore=0 phishscore=0 suspectscore=0 bulkscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2306200000 definitions=main-2307260192 X-Proofpoint-ORIG-GUID: nSAE1Y3_B_EkQtwN2xitHy0D9XeaXxLT X-Proofpoint-GUID: nSAE1Y3_B_EkQtwN2xitHy0D9XeaXxLT Received-SPF: pass client-ip=205.220.177.32; envelope-from=drew.adams@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:308130 Archived-At: I don't have native compilation for my laptop, but I received a bug report = from a user of one of my libraries, and I get the feeling that native compi= lation (which this user has) is interfering and perhaps bugged. 1. My code, when loaded, saves the original definitions of some functions, = such as `read-buffer', by creating a `defalias' for each of them, such as t= his one: (defalias 'ORIG-read-buffer (symbol-function 'read-buffer) 2. I define a global minor mode that, when turned on, redefines those saved= functions, such as `read-buffer', using `fset', to using definitions appro= priate to the minor mode. =20 3. When the minor mode is turned off I reset those function definitions to = the saved (`defalias'ed) versions, using `fset'. (I do this dance because I want the library to work properly also with olde= r Emacs versions. No comments, please, about its fragility or other weakne= sses.) ___ This is the problem, reported in Emacs 28.2 with native compilation: Emacs 28 added an additional optional arg to function `read-buffer' (which = is defined in C). My substitute version of `read-buffer', which is used wh= en my minor mode is turned on, has only 1 required arg and 2 optional, not = 1 required and 3 optional. Obviously, for any code that will try to pass 4 args, I need to update my c= ode to accommodate the 4th arg. I haven't done that yet. But my question is about code that ostensibly passes 3 or fewer args. An e= rror is nevertheless raised, saying that 4 args were passed and only 3 were= allowed. The standard code, whose vanilla source definition (in `window.e= l') passes only 3 args, in actuality, at runtime, passes 4 args, the 4th on= e being explicitly nil. Recipe: the minor mode is turned on, and `C-x 5 b' is tried. An error is r= aised: Debugger entered--Lisp error: (wrong-number-of-arguments # 4) read-buffer("Switch to buffer in other frame: " # confirm-aft= er-completion nil) read-buffer-to-switch("Switch to buffer in other frame: ") byte-code("\300\301!C\207" [read-buffer-to-switch "Switch to buffer in ot= her frame: "] 2) call-interactively(switch-to-buffer-other-frame nil nil) command-execute(switch-to-buffer-other-frame) I wouldn't have a clue to what is going on here from that backtrace, since = function `my-read-buffer' accepts 3 args and the source code for `read-buff= er-to-switch' passes 3 args. I got a glue (I think), from this: For the reporting user `C-h k C-x 5 b' s= ays this: C-x 5 b runs the command switch-to-buffer-other-frame (found in global-map)= , which is an interactive native-compiled Lisp function in '/var/lib/snapd/= snap/emacs/2031/usr/share/emacs/28.2/lisp/window.el'. It's that "native-compiled" that makes me wonder. If the user loads the Li= sp source file, `window.el', there's no problem. But it looks kinda like n= ative compilation has "baked-in" the call to `read-buffer', passing an expl= icit 4th arg, nil, instead of passing only the 3 args that the source code = says to pass. Passing 4 args, the last of which is nil, isn't the same thing as passing 3= args, but it looks like native compilation takes a shortcut, assuming that= it's the same thing. Is this a native-compilation bug? Is it some other Emacs bug? Or is this = just the way things are going to be from now on - "situation normale, rien = =E0 signaler"? Let me know, if my guesses are near the target, or if I'm missing something= .