Message ID | 455400c598a6a9e0932c4c5b15c5d8fc30355ade.camel@zoho.com |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2483:b0:fb:cd0c:d3e with SMTP id q3csp417163dyi; Thu, 21 Dec 2023 05:42:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IF9kj0Tt51RX807Agxr8R60GoBrn968HuhWDiPQJCZ4JfTI9zR8hAhfFDVjGuRL/HSSJSRP X-Received: by 2002:a05:6830:609:b0:6db:b3bc:78cf with SMTP id w9-20020a056830060900b006dbb3bc78cfmr1567638oti.65.1703166164613; Thu, 21 Dec 2023 05:42:44 -0800 (PST) ARC-Seal: i=3; a=rsa-sha256; t=1703166164; cv=pass; d=google.com; s=arc-20160816; b=YIfD1/KAaxKRkSgotkfBKasfMutijixlT8Ou8q6BihxofqPJGkju0hNMND0vjipHqK hRWSE4aN/dQZL13HLNCQJBQlhYrEUkUgWYw7DatCgPQ6tgYHkJ2YLHHYaO6/vEl9HgjX dh2/4MN0BERPdvVmKyW0PIM8bx5MNDP8eybsNcECHdeWHSYS2ftxDe1Ms3bmXXejf9j5 K8glQ3iUHJg1Q/ayswBk9AcIzG0LKzU9Y9lpNcbp8m2bb90HxiAU1+9V/d41/sqr1Oa0 t9rWjM375TB1KDvew9c4LlNsArudqjybRa2C09RDnrC/u4GvETdzzq40hOWZROFLx76+ 1KnQ== ARC-Message-Signature: i=3; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:feedback-id:mime-version :user-agent:autocrypt:date:cc:to:from:subject:message-id :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=80GdQU2Va+1r1F/E3jv3oM2mqYnVV8v4+MzqrSuVGv4=; fh=T+OJrpbtdAAwCS7EoTzoGzx8W2CueTuN+vhPCLC4QI4=; b=Pc495iKdl45DtJVIRUKDaWSvIrxU8+IdnTfZ8QMsg+nh4nW6RlXxnTRhqF2CsUuuzF EQoFqyZs/tYyTSgVFv9S9OjYm+/qEbRUWjpC5cauHYomYD/yvGK/tkn+jWwjJYfqK2HK yTPRLgvcGoRRM5fa9XCC1N0Do8bPwMeF4UG1yqidTBUcEpt3NDeQTc93m+l5yn73hbcO mBZNHq52S/U/d98f5lg0Gyu/VQTJAnTbDQ56faffOTh8OF4Y1xaQ8nkR2kHx1wQjLDsF RcDcZPCn1Jv2jtuN64ATejgQ4q8/DW+FIaYZVd4pJewKKDTBbyJ7iBkp30J1AXvkUW2h 4XmQ== ARC-Authentication-Results: i=3; mx.google.com; dkim=pass header.i=@zoho.com header.s=zm2022 header.b=InMlHtAQ; arc=pass (i=2); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=zoho.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id h27-20020a05620a13fb00b0077d6c64912esi2084437qkl.52.2023.12.21.05.42.44 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 05:42:44 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@zoho.com header.s=zm2022 header.b=InMlHtAQ; arc=pass (i=2); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=zoho.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 50B113864C6A for <ouuuleilei@gmail.com>; Thu, 21 Dec 2023 13:42:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from sender4-pp-o90.zoho.com (sender4-pp-o90.zoho.com [136.143.188.90]) by sourceware.org (Postfix) with ESMTPS id 6CFB3385829D; Thu, 21 Dec 2023 13:42:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6CFB3385829D Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=zoho.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=zoho.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6CFB3385829D Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=136.143.188.90 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1703166141; cv=pass; b=Ao9u0IzJz3mqEBgsLztNn0gLLKInHTgN3F3944pnkcHyZ7j9+23ifU1oZ/4U5rYYk6uzYAs2yt3sNFAVhuZIPsmiGrCBaNhrllIzIe2TCHE3W8dn/aBIIZz9KyonU2GurXQeztUXaWPo6n+JA+bCJrS06lW9LVMlT2aNHzSyw7Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1703166141; c=relaxed/simple; bh=rna0+gZNckU5gKDirZdj69a9h7TcipZEnenvliL5Qi8=; h=DKIM-Signature:Message-ID:Subject:From:To:Date:MIME-Version; b=KhUYX41+ZaUrh8MpWEM90Sk42gG7Tw5US/mmXcmBj7xb4UK/l7ud02ydE01hAxIDIUiYzk2Eg20KpGf5jJVRqElqoQPBoAamCZ0nPWqz5hXxUgACNLqfkhkLO5wC0qFItzCUVTKYJfvkNnkJA2NybSuJfzW79aQqI8r8ojvMOj4= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1703166134; cv=none; d=zohomail.com; s=zohoarc; b=GAGfFsH1Cf7RlZlTKWh6ezQcPepvKfNdzlrPfMiBtnYHG1FkMYg9d3Rl3zXiYFAR2R5ITgbVQPXp/IKvw3f1JiYssYYVk1TXuuG4rezJrQMzojeCiOto1XlltLbz0LHUCDKSGkErFM1KUMnXxMsHkMQMQIEpaBAxFPwVA0oHF7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1703166134; h=Content-Type:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=80GdQU2Va+1r1F/E3jv3oM2mqYnVV8v4+MzqrSuVGv4=; b=nn0wjLKIP6L0sp2qBq/YUl7jNGwaEoBq2SJCYA4ZSvk6nW1ykMngpSbQdwbC5+UxMBh9IWLwwyj1zpK8WZG1FT49TLXx/Xtri67ag6AUVZepgnqnBeC5iTT6lJs/wOG1XUMLVS8nNzviSQMGr8y8pRk/fMkN6aq2jqPqCKxruEY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=zoho.com; spf=pass smtp.mailfrom=bouanto@zoho.com; dmarc=pass header.from=<bouanto@zoho.com> DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1703166134; s=zm2022; d=zoho.com; i=bouanto@zoho.com; h=Message-ID:Subject:Subject:From:From:To:To:Cc:Cc:Date:Date:Content-Type:MIME-Version:Feedback-ID:Message-Id:Reply-To; bh=80GdQU2Va+1r1F/E3jv3oM2mqYnVV8v4+MzqrSuVGv4=; b=InMlHtAQGR0lMK35b15I2GPvpAqrZLblHK43k8LQ3rTwzY+yucI4ZBKseIAVVjAo M9beYMhFmipNT8EZ0mvLTPj9GGJ1P5AThiwnejB2D3jD4XGGAR96xrotwJhNTV5v5To TGYafLG0a0wA4R4hD8rypr2//6umJzzwmTr0d2KQ= Received: from [192.168.1.172] (38.87.11.6 [38.87.11.6]) by mx.zohomail.com with SMTPS id 1703166133420521.0283635805638; Thu, 21 Dec 2023 05:42:13 -0800 (PST) Message-ID: <455400c598a6a9e0932c4c5b15c5d8fc30355ade.camel@zoho.com> Subject: [PATCH] libgccjit: Support signed char flag From: Antoni Boucher <bouanto@zoho.com> To: "jit@gcc.gnu.org" <jit@gcc.gnu.org>, "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org> Cc: David Malcolm <dmalcolm@redhat.com> Date: Thu, 21 Dec 2023 08:42:11 -0500 Autocrypt: addr=bouanto@zoho.com; prefer-encrypt=mutual; keydata=mQENBFOSMLQBCADO5aw6Ys8thMQUNzrwAnfJX2wbgWiz0pQ01DjYj22eeIpChkoZn6LWdt4dieq30u2rFi/yQzJ02foHwI2+aL9rU6xz/x4TwqyRJQGMOqklNc3R+pdXmH4WDQkQDWmLxvc07vu+zb8Tx5A6pMDh4J2ncCEhLEUcH39Yq/yg4eBnFwUX6N7kakvHrnScGNqhnSFCacoJeMJUAR+1G7VBSBd++jmnHLnx3mj7QkRZVECJUw2zqiv1yReCC6GU4SvqLjdqm5ZGeoWOqD/NHjBRoEeOVjzp6M/qOjjWRbkJVqmvgfcD8UytSSqqboR35YFT4L+rZt2ri3T12MJb3i5syCAXABEBAAG0IUFudG9uaSBCb3VjaGVyIDxib3VhbnRvQHpvaG8uY29tPokBVgQTAQgAQAIbIwcLCQgHAwIBBhUIAgkKCwQWAgMBAh4BAheAFiEEOELC4Uw1Jeb66YE6RVeGAwR4zcEFAlz4QM4FCRLMEZoACgkQRVeGAwR4zcFBQQf/afttJrA/puADQZhrDfkgr0MFvq6iB+GCy1b8BkXimk1TOXTPt87YLehSeijNu3JkYhl5eRc87BNfU9J87KfI/KIy6hZxqlDXk16FhW9bw/7wYEA0hpb3MUn7xLElXDT0ZHaD+KTe8Oun7qfzgx5RlL6r/WODf3CkSpO085R/rfeBqDEx9mVlhDWgq6Az3CZoD+3CqiCKVqmDuHTWz4kwrd9AM5eVcLvvLKnZIdoIp+G5Ao6BvaGlZyfenN1iOSjLy2NXNt4MnUt0lUYEP5KSIIRhHQ8xkUbj7eWUmaahkxhNb3fH3sAPwGnRZrPpb4rgYzNmSk63wWMh9M2xk+rLb7kBDQRTkjC0AQgAumZzsAV/UFWI+dpzebQfma36kKYZZFuseant5sq/HWP553XQ/U6ttJiKyN5MpCqtxvCAoRplf42YhlHuFqgf73WJxoJ6Y+sdyqoBSwlR+ gzAneAmsa8gmmY0wawH0Z2leazjKuS7mJjVEQZg0ZGsiCVRGeRnDqFGzDEzDc9ngWKSoTq0fKzlGy1X85OrtmUrvEbhSo6HP+FoeunHkIqrxu3w3vDoFEXxVQlKI6V3I4nCz5n6DB8WR3L7nsiiTnOiGirPw1ngvWFLW86kkA4FJpayc8Xl3va3SLY+2y4yuROboX2DVI4AC/Qeug/mDiBicPxkP6YfUartQRMe6obkEQARAQABiQE8BBgBCAAmAhsMFiEEOELC4Uw1Jeb66YE6RVeGAwR4zcEFAlz4QRsFCRLMEecACgkQRVeGAwR4zcE56ggAgTgrJInBKC+7552Dpccuo6Clh3wZfjlNLv9/6r5lKEbaNzaTrfhPiAP4WgnluIUmj8amOFLFJpj+BAVNOXpZ4D2R3o9ch8z7fot+fW4Yw+PKIxH4I2xEys8ndoEB3aiQwHjKcGIhkIU7uyMJFQr2aWjdTY0gmXw0YZueHOSLgo7uX4XKxB8fEO/yto/Tff2YBAAq+AtNwt+Gh5YS9rZw7rwUTWMi84yVOlc+zRE79E9NJkvdTwX7IJYo64VzIRNfgHsn7QNdVzuM1XIFHl+Glk6cIlI8s6BO7nEoCn3hTF104fQTAO3fEs+XXZOKXo2lk8faowEoPq5r58StrV0nyg== Content-Type: multipart/mixed; boundary="=-KBgF6eBIAYuJEUi9C/fb" User-Agent: Evolution 3.50.2 MIME-Version: 1.0 X-Zoho-Virus-Status: 1 X-Zoho-AV-Stamp: zmail-av-1.1.0/203.141.47 Feedback-ID: rr08011228fdbdcf37c3681802a75a39590000229e09b57e4e78c6d32a4fc22be9a795ba0a689903035197092e:zu080112268da119955b9bf32538a86ec60000489364f54f1e8e58bec887aeb2c0b2d47b4e3a1595998ce5:rf08011232737195dfd6922677b4846080000055ce48004eca8122f01c09bc88d4c062234890033b2b70c06ca90daf2db8619046b0c53f:ZohoMail X-ZohoMailClient: External X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785899164241090982 X-GMAIL-MSGID: 1785899164241090982 |
Series |
libgccjit: Support signed char flag
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Antoni Boucher
Dec. 21, 2023, 1:42 p.m. UTC
Hi. This patch adds support for the -fsigned-char flag. I'm not sure how to test it since I stumbled upon this bug when I found this other bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107863) which is now fixed. Any idea how I could test this patch? Thanks for the review.
Comments
On Thu, 2023-12-21 at 08:42 -0500, Antoni Boucher wrote: > Hi. > This patch adds support for the -fsigned-char flag. Thanks. The patch looks correct to me. > I'm not sure how to test it since I stumbled upon this bug when I > found > this other bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107863) > which is now fixed. > Any idea how I could test this patch? We already document that GCC_JIT_TYPE_CHAR has "some signedness". The bug being fixed here is that gcc_jit_context compilations were always treating "char" as unsigned, regardless of the value of -fsigned-char (either from the target's default, or as a context option), when it makes more sense to follow the C frontend's behavior. So perhaps jit-written code with a context that has -fsigned-char as an option (via gcc_jit_context_add_command_line_option), and which promotes a negative char to a signed int, and then returns the result as an int? Presumably if we're erroneously forcing "char" to be unsigned, the int will be in the range 0x80 to 0xff, rather that being negative. Dave
Thanks for the review and idea. Here's the updated patch. I added a test, but I could not set -fsigned- char as this is not an option accepted by the jit frontend. However, the test still works in the sense that it fails without this patch and passes with it. I'm just wondering if it would pass on all targets or if I should add a target filtering directive to only execute on some target. What do you think? On Tue, 2024-01-09 at 11:01 -0500, David Malcolm wrote: > On Thu, 2023-12-21 at 08:42 -0500, Antoni Boucher wrote: > > Hi. > > This patch adds support for the -fsigned-char flag. > > Thanks. The patch looks correct to me. > > > I'm not sure how to test it since I stumbled upon this bug when I > > found > > this other bug > > (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107863) > > which is now fixed. > > Any idea how I could test this patch? > > We already document that GCC_JIT_TYPE_CHAR has "some signedness". > The > bug being fixed here is that gcc_jit_context compilations were always > treating "char" as unsigned, regardless of the value of -fsigned-char > (either from the target's default, or as a context option), when it > makes more sense to follow the C frontend's behavior. > > So perhaps jit-written code with a context that has -fsigned-char as > an > option (via gcc_jit_context_add_command_line_option), and which > promotes a negative char to a signed int, and then returns the result > as an int? Presumably if we're erroneously forcing "char" to be > unsigned, the int will be in the range 0x80 to 0xff, rather that > being > negative. > > Dave >
From 45719be81ab71983ab10ecb67139eaf02955e4db Mon Sep 17 00:00:00 2001 From: Antoni Boucher <bouanto@zoho.com> Date: Mon, 3 Oct 2022 19:11:39 -0400 Subject: [PATCH] libgccjit: Support signed char flag gcc/jit/ChangeLog: * dummy-frontend.cc (jit_langhook_init): Send flag_signed_char argument to build_common_tree_nodes. --- gcc/jit/dummy-frontend.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/jit/dummy-frontend.cc b/gcc/jit/dummy-frontend.cc index 9f71bca44b1..11615b30f40 100644 --- a/gcc/jit/dummy-frontend.cc +++ b/gcc/jit/dummy-frontend.cc @@ -607,7 +607,7 @@ jit_langhook_init (void) diagnostic_starter (global_dc) = jit_begin_diagnostic; diagnostic_finalizer (global_dc) = jit_end_diagnostic; - build_common_tree_nodes (false); + build_common_tree_nodes (flag_signed_char); build_common_builtin_nodes (); -- 2.43.0