From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#43725: 28.0.50; Include feature/native-comp into master Date: Fri, 19 Feb 2021 22:03:32 +0000 Message-ID: References: <87wny8xwcc.fsf@gnus.org> <83im9sqk1b.fsf@gnu.org> <83v9drp8va.fsf@gnu.org> <831rdjd95w.fsf@gnu.org> <83k0r53ygd.fsf@gnu.org> <83im6o4hrc.fsf@gnu.org> <83tuq82qmb.fsf@gnu.org> Reply-To: Andrea Corallo Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11314"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: larsi@gnus.org, monnier@iro.umontreal.ca, 43725@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 19 23:09:57 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1lDDyF-0002pk-V4 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Feb 2021 23:09:55 +0100 Original-Received: from localhost ([::1]:35864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lDDyE-0007ka-SK for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 19 Feb 2021 17:09:54 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43696) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lDDsY-00006a-2z for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2021 17:04:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39009) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lDDsX-0006x8-OE for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2021 17:04:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lDDsX-0007vd-J2 for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2021 17:04:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Feb 2021 22:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43725 X-GNU-PR-Package: emacs Original-Received: via spool by 43725-submit@debbugs.gnu.org id=B43725.161377222230452 (code B ref 43725); Fri, 19 Feb 2021 22:04:01 +0000 Original-Received: (at 43725) by debbugs.gnu.org; 19 Feb 2021 22:03:42 +0000 Original-Received: from localhost ([127.0.0.1]:50555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lDDsD-0007v5-Jt for submit@debbugs.gnu.org; Fri, 19 Feb 2021 17:03:41 -0500 Original-Received: from mx.sdf.org ([205.166.94.24]:54369) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lDDs8-0007us-V6 for 43725@debbugs.gnu.org; Fri, 19 Feb 2021 17:03:40 -0500 Original-Received: from mab (ma.sdf.org [205.166.94.33]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 11JM3Wkb017905 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Fri, 19 Feb 2021 22:03:33 GMT In-Reply-To: <83tuq82qmb.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 19 Feb 2021 14:23:24 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:200387 Archived-At: Eli Zaretskii writes: >> From: Andrea Corallo >> Cc: bug-gnu-emacs@gnu.org, larsi@gnus.org, monnier@iro.umontreal.ca, >> 43725@debbugs.gnu.org >> Date: Fri, 19 Feb 2021 11:13:14 +0000 >> >> > #if EMACS_INT_MAX > LONG_MAX >> > return emit_rvalue_from_unsigned_long_long (... >> > #else >> > return gcc_jit_context_new_rvalue_from_long (... >> > #endif >> > >> > Does that work well? >> >> Unfortunately this is a compile time (for the native compiler) >> decision. If val fits into a long we want to emit simply that. > > OK, then how about my original proposal, viz.: > > if (EMACS_INT_MAX > LONG_MAX) > { > if (val > LONG_MAX || val < LONG_MIN) > ... > else > ... > } > > You could also #ifdef this conditioned on WINDOWSNT, since MS-Windows > is the only platform where this matters. Okay 14e6268d14 is arranging things as follow: #ifdef WIDE_EMACS_INT if (val > LONG_MAX || val < LONG_MIN) return emit_rvalue_from_unsigned_long_long (comp.emacs_uint_type, val); #endif return gcc_jit_context_new_rvalue_from_long (comp.ctxt, comp.emacs_uint_type, val); >> At this point I'm starting to think that the original formulation is >> probably the lesser of evils. > > Believe me, it isn't. For starters, it is not clear what it does. > >> 'emit_rvalue_from_unsigned_long_long' was added by me as libgccjit so >> far has no long long support. As this is shifting the numeric argument >> to emit the code that re-create the long long equivalent using an >> unsigned was the natural choice to avoid UB. >> >> Admittedly we could just cast inside >> 'emit_rvalue_from_unsigned_long_long' and rename it into >> 'emit_rvalue_from_long_long' but I'm not sure is that important. > > Either that, or some comment would be good enough. I realized we already had also the signed variant so with 92fe7a91f4 I removed the unsigned one and we always use 'emit_rvalue_from_long_long' now. Andrea