Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/811595/?format=api
{ "id": 811595, "url": "http://patchwork.ozlabs.org/api/1.2/patches/811595/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20170908133620.GA100539@adacore.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.2/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170908133620.GA100539@adacore.com>", "list_archive_url": null, "date": "2017-09-08T13:36:20", "name": "[Ada] Extend efficient array reset to all elementary types", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "197053f307b5583e1b17a2b9bbd77de47269a268", "submitter": { "id": 4418, "url": "http://patchwork.ozlabs.org/api/1.2/people/4418/?format=api", "name": "Arnaud Charlet", "email": "charlet@adacore.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20170908133620.GA100539@adacore.com/mbox/", "series": [ { "id": 2214, "url": "http://patchwork.ozlabs.org/api/1.2/series/2214/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=2214", "date": "2017-09-08T13:36:20", "name": "[Ada] Extend efficient array reset to all elementary types", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/2214/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/811595/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/811595/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-461728-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": [ "patchwork-incoming@bilbo.ozlabs.org", "mailing list gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461728-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"v2BkCyUF\"; dkim-atps=neutral", "sourceware.org; auth=none" ], "Received": [ "from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xpddX66jfz9s7p\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 8 Sep 2017 23:36:32 +1000 (AEST)", "(qmail 44283 invoked by alias); 8 Sep 2017 13:36:23 -0000", "(qmail 44052 invoked by uid 89); 8 Sep 2017 13:36:23 -0000", "from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tFri, 08 Sep 2017 13:36:21 +0000", "from localhost (localhost.localdomain [127.0.0.1])\tby\n\tfiltered-rock.gnat.com (Postfix) with ESMTP id 80F275628A;\n\tFri, 8 Sep 2017 09:36:20 -0400 (EDT)", "from rock.gnat.com ([127.0.0.1])\tby localhost (rock.gnat.com\n\t[127.0.0.1]) (amavisd-new, port 10024)\twith LMTP id\n\tVmPmCWbg0mG4; Fri, 8 Sep 2017 09:36:20 -0400 (EDT)", "from tron.gnat.com (tron.gnat.com [205.232.38.10])\tby\n\trock.gnat.com (Postfix) with ESMTP id 7065856285;\n\tFri, 8 Sep 2017 09:36:20 -0400 (EDT)", "by tron.gnat.com (Postfix, from userid 4192)\tid 6F5964A4;\n\tFri, 8 Sep 2017 09:36:20 -0400 (EDT)" ], "DomainKey-Signature": "a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; q=dns;\n\ts=default; b=kK2DoIYQXs8vTQvq/+psPiHk00ddR20NiEJ/Ez6FVGXLCb4ywa\n\t3X2siYdvs4Aqfw29nCbzUFVzQ2I6sqMzmzrGM7ME9SdfQQLAtBVEIq3DAOitCAy9\n\tKbexWfVhCzmcA7nm7DfC+HyEul0QqHb76ATAxMw3VPnaKQKtFiQRQElZc=", "DKIM-Signature": "v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=DYBujd9RTqNpAVw4nUNbu8FF8z0=; b=v2BkCyUFmlYtZl+W/xOF\n\tLl57Q8QlX9SwFuidQXYweUpRvVSxKcgRdJsVjnmgkd4Ejg4TyETaAQVP2TabNZWp\n\tEZGAwI/E8/aQHvVe7sg81dUcsC505uLWjIXIwLfgyaxod2wVdzYnvtQKP9igrkv5\n\t8FmhUYj+mSzkercWZkqzHVY=", "Mailing-List": "contact gcc-patches-help@gcc.gnu.org; run by ezmlm", "Precedence": "bulk", "List-Id": "<gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>", "List-Archive": "<http://gcc.gnu.org/ml/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-help@gcc.gnu.org>", "Sender": "gcc-patches-owner@gcc.gnu.org", "X-Virus-Found": "No", "X-Spam-SWARE-Status": "No, score=-10.5 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS,\n\tRCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=", "X-HELO": "rock.gnat.com", "Date": "Fri, 8 Sep 2017 09:36:20 -0400", "From": "Arnaud Charlet <charlet@adacore.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "Eric Botcazou <ebotcazou@adacore.com>", "Subject": "[Ada] Extend efficient array reset to all elementary types", "Message-ID": "<20170908133620.GA100539@adacore.com>", "MIME-Version": "1.0", "Content-Type": "multipart/mixed; boundary=\"EVF5PPMfhYS0aIcm\"", "Content-Disposition": "inline", "User-Agent": "Mutt/1.5.23 (2014-03-12)" }, "content": "This change extends the efficient handling of an array reset to 0 by means\nof an aggregate with a single Others choice from a discrete component type\nto any elementary type.\n\nThe 3 instances of the Reset procedure below must invoke memset:\n\nwith G;\n\npackage P is\n\n subtype Index is Positive range 1 .. 128;\n\n type Ptr is access all Integer;\n\n package My_G_I is new G (Index, Integer, 0);\n\n package My_G_F is new G (Index, Float, 0.0);\n\n package My_G_P is new G (Index, Ptr, null);\n\nend P;\n\ngeneric\n\n type Header_Num is range <>;\n\n type Element is private;\n\n Null_Element : Element;\n\npackage G is\n\n procedure Reset;\n\nend G;\n\npackage body G is\n\n Table : array (Header_Num) of Element;\n\n procedure Reset is\n begin\n Table := (others => Null_Element);\n end;\n \nend G;\n\nTested on x86_64-pc-linux-gnu, committed on trunk\n\n2017-09-08 Eric Botcazou <ebotcazou@adacore.com>\n\n\t* exp_aggr.adb: Add with & use clause for Urealp.\n\t(Aggr_Assignment_OK_For_Backend): Accept (almost all)\n\telementary types instead of just discrete types.\n\t* sem_eval.adb (Expr_Value): Deal with N_Null for access types.\n\t* gcc-interface/trans.c (gnat_to_gnu) <N_Assignment_Statement>:\n\tBe prepared for the FP zero value in the memset case. Add small\n\tguard.", "diff": "Index: exp_aggr.adb\n===================================================================\n--- exp_aggr.adb\t(revision 251893)\n+++ exp_aggr.adb\t(working copy)\n@@ -61,6 +61,7 @@\n with Stringt; use Stringt;\n with Tbuild; use Tbuild;\n with Uintp; use Uintp;\n+with Urealp; use Urealp;\n \n package body Exp_Aggr is\n \n@@ -4894,7 +4895,7 @@\n -- 4. The array type has no null ranges (the purpose of this is to\n -- avoid a bogus warning for an out-of-range value).\n \n- -- 5. The component type is discrete\n+ -- 5. The component type is elementary\n \n -- 6. The component size is Storage_Unit or the value is of the form\n -- M * (1 + A**1 + A**2 + .. A**(K-1)) where A = 2**(Storage_Unit)\n@@ -4970,7 +4971,13 @@\n return False;\n end if;\n \n- if not Is_Discrete_Type (Ctyp) then\n+ -- All elementary types are supported except for fat pointers\n+ -- because they are not really elementary for the backend.\n+\n+ if not Is_Elementary_Type (Ctyp)\n+ or else (Is_Access_Type (Ctyp)\n+ and then Esize (Ctyp) /= System_Address_Size)\n+ then\n return False;\n end if;\n \n@@ -4990,6 +4997,14 @@\n return False;\n end if;\n \n+ -- The only supported value for floating point is 0.0\n+\n+ if Is_Floating_Point_Type (Ctyp) then\n+ return Expr_Value_R (Expr) = Ureal_0;\n+ end if;\n+\n+ -- For other types, we can look into the value as an integer\n+\n Value := Expr_Value (Expr);\n \n if Has_Biased_Representation (Ctyp) then\nIndex: sem_eval.adb\n===================================================================\n--- sem_eval.adb\t(revision 251892)\n+++ sem_eval.adb\t(working copy)\n@@ -4199,6 +4199,12 @@\n pragma Assert (Is_Fixed_Point_Type (Underlying_Type (Etype (N))));\n Val := Corresponding_Integer_Value (N);\n \n+ -- The NULL access value\n+\n+ elsif Kind = N_Null then\n+ pragma Assert (Is_Access_Type (Underlying_Type (Etype (N))));\n+ Val := Uint_0;\n+\n -- Otherwise must be character literal\n \n else\nIndex: gcc-interface/trans.c\n===================================================================\n--- gcc-interface/trans.c\t(revision 251892)\n+++ gcc-interface/trans.c\t(working copy)\n@@ -7037,14 +7037,17 @@\n \t /* Or else, use memset when the conditions are met. */\n \t else if (use_memset_p)\n \t {\n-\t tree value = fold_convert (integer_type_node, gnu_rhs);\n+\t tree value\n+\t\t= real_zerop (gnu_rhs)\n+\t\t ? integer_zero_node\n+\t\t : fold_convert (integer_type_node, gnu_rhs);\n \t tree to = gnu_lhs;\n \t tree type = TREE_TYPE (to);\n \t tree size\n \t = SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_SIZE_UNIT (type), to);\n \t tree to_ptr = build_fold_addr_expr (to);\n \t tree t = builtin_decl_explicit (BUILT_IN_MEMSET);\n-\t if (TREE_CODE (value) == INTEGER_CST)\n+\t if (TREE_CODE (value) == INTEGER_CST && !integer_zerop (value))\n \t\t{\n \t\t tree mask\n \t\t = build_int_cst (integer_type_node,\n", "prefixes": [ "Ada" ] }