Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/806249/?format=api
{ "id": 806249, "url": "http://patchwork.ozlabs.org/api/patches/806249/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/be2d7941-5660-529c-88aa-ce1335073a33@netcologne.de/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/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": "<be2d7941-5660-529c-88aa-ce1335073a33@netcologne.de>", "list_archive_url": null, "date": "2017-08-27T14:21:10", "name": "[fortran] Warn about suspicious assignment to contiguous pointers", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "b5fc784c90adfd3137158d63f0922b82e522e378", "submitter": { "id": 4465, "url": "http://patchwork.ozlabs.org/api/people/4465/?format=api", "name": "Thomas Koenig", "email": "tkoenig@netcologne.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/be2d7941-5660-529c-88aa-ce1335073a33@netcologne.de/mbox/", "series": [ { "id": 24, "url": "http://patchwork.ozlabs.org/api/series/24/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=24", "date": "2017-08-27T14:21:10", "name": "[fortran] Warn about suspicious assignment to contiguous pointers", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/24/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/806249/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/806249/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-return-460990-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-460990-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=\"a829DQ5B\"; 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 3xgHC35j73z9sD9\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 28 Aug 2017 00:21:34 +1000 (AEST)", "(qmail 70740 invoked by alias); 27 Aug 2017 14:21:20 -0000", "(qmail 69656 invoked by uid 89); 27 Aug 2017 14:21:18 -0000", "from cc-smtpout3.netcologne.de (HELO cc-smtpout3.netcologne.de)\n\t(89.1.8.213) by sourceware.org\n\t(qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tSun, 27 Aug 2017 14:21:16 +0000", "from cc-smtpin2.netcologne.de (cc-smtpin2.netcologne.de\n\t[89.1.8.202])\tby cc-smtpout3.netcologne.de (Postfix) with\n\tESMTP id 0473C1276E; Sun, 27 Aug 2017 16:21:14 +0200 (CEST)", "from localhost (localhost [127.0.0.1])\tby cc-smtpin2.netcologne.de\n\t(Postfix) with ESMTP id EBD0111DB4;\n\tSun, 27 Aug 2017 16:21:13 +0200 (CEST)", "from [78.35.138.130] (helo=cc-smtpin2.netcologne.de)\tby localhost\n\twith ESMTP (eXpurgate 4.1.9)\t(envelope-from\n\t<tkoenig@netcologne.de>)\tid\n\t59a2d559-02b8-7f0000012729-7f000001aa51-1\tfor\n\t<multiple-recipients>; Sun, 27 Aug 2017 16:21:13 +0200", "from [192.168.178.20] (xdsl-78-35-138-130.netcologne.de\n\t[78.35.138.130])\t(using TLSv1.2 with cipher\n\tECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\t(No client\n\tcertificate requested)\tby cc-smtpin2.netcologne.de (Postfix)\n\twith ESMTPSA; Sun, 27 Aug 2017 16:21:10 +0200 (CEST)" ], "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:to\n\t:from:subject:message-id:date:mime-version:content-type; q=dns;\n\ts=default; b=W4OHYJhfwUdhrdQrztTsqMEPOsM0KSxDbwCsncGSOYrgssY868\n\toEvuTmsC4VNl6sYe+xFemURisg9zCSEpL8u01OvBXTkND2iA2op17g8AByTJBsHN\n\tcuVKmELgC1oRuRZSc2ClaZcyKJe46MvAMKTLdpYjMvIAOGx+59W8AFgUU=", "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:to\n\t:from:subject:message-id:date:mime-version:content-type; s=\n\tdefault; bh=WgKgmuocEDZ+2oAfh/Cq9J3vkAQ=; b=a829DQ5BAuKLgizpb74U\n\tKtG/14GeZpOAEbRkXHCojdofi4/ACLVFOO2xorAHYZZ+IXMRdZYLfCaw6NkgFwuH\n\tAbQzsM7qwPI7TvTzcBLWlBfphRJCFhlcVvMsI0nj1K/2aCqxXN+MhTOtF7rRyqiJ\n\teuqLF2RXWHgFRyQeWVQHLYM=", "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=-11.9 required=5.0 tests=AWL, BAYES_00,\n\tGIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=UD:ar, reshape,\n\tdubious, contiguous", "X-Spam-User": "qpsmtpd, 2 recipients", "X-HELO": "cc-smtpout3.netcologne.de", "To": "\"fortran@gcc.gnu.org\" <fortran@gcc.gnu.org>,\n\tgcc-patches <gcc-patches@gcc.gnu.org>", "From": "Thomas Koenig <tkoenig@netcologne.de>", "Subject": "[patch,\n\tfortran] Warn about suspicious assignment to contiguous pointers", "Message-ID": "<be2d7941-5660-529c-88aa-ce1335073a33@netcologne.de>", "Date": "Sun, 27 Aug 2017 16:21:10 +0200", "User-Agent": "Mozilla/5.0 (X11; Linux x86_64;\n\trv:52.0) Gecko/20100101 Thunderbird/52.2.1", "MIME-Version": "1.0", "Content-Type": "multipart/mixed;\n\tboundary=\"------------FD45B753835D3360AB56E1DB\"" }, "content": "Hello world,\n\nthe attached patch warns about the dubious pointer assignments (see\ntest case for details). I think an unconditional warning is OK\nin this case because\n\n- Assigning to a pointer from an obvious non-contiguous target\n is not useful at all, that I can see\n\n- Some language laywer will come up with the fact that it is,\n in fact, legal if the target is empty or has a single\n element only, so a hard error would be a rejects-valid.\n\nHowever, I can also make this into a warning depending on\n-Wall, if this is preferred.\n\nRegresson-tested. OK for trunk?\n\nRegards\n\n\tThomas\n\n2017-08-27 Thomas Koenig <tkoenig@gcc.gnu.org>\n\n PR fortran/49232\n * expr.c (gfc_check_pointer_assign): Warn for\n suspicious assignments with contiguous pointers.\n\n2017-08-27 Thomas Koenig <tkoenig@gcc.gnu.org>\n\n PR fortran/49232\n * gfortran.dg/contiguous_4.f90: New test.", "diff": "Index: expr.c\n===================================================================\n--- expr.c\t(Revision 239977)\n+++ expr.c\t(Arbeitskopie)\n@@ -3764,6 +3764,66 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_ex\n \t }\n }\n \n+ /* Warn for suspicious assignments like\n+\n+ pointer, real, dimension(:), contiguous :: p\n+ real, dimension(10,10) :: a\n+ p => a(:,:,2) or p => a(2:4,:) */\n+\n+ if (lhs_attr.contiguous)\n+ {\n+ gfc_array_ref *ar;\n+ int i;\n+ bool do_warn;\n+ \n+ do_warn = false;\n+ ar = NULL;\n+\n+ for (ref = rvalue->ref; ref; ref = ref->next)\n+\t{\n+\t if (ref->type == REF_ARRAY)\n+\t {\n+\t ar = &ref->u.ar;\n+\t break;\n+\t }\n+\t}\n+ if (ar && ar->type == AR_SECTION)\n+\t{\n+\n+\t for (i = 0; i < ar->dimen; i++)\n+\t {\n+\t if (ar->dimen_type[i] == DIMEN_RANGE && ar->stride[i]\n+\t\t && (ar->stride[i]->expr_type != EXPR_CONSTANT\n+\t\t || (ar->stride[i]->expr_type == EXPR_CONSTANT\n+\t\t\t && mpz_cmp_si (ar->stride[i]->value.integer, 1))))\n+\t\t{\n+\t\t do_warn = true;\n+\t\t break;\n+\t\t}\n+\t }\n+\t if (!do_warn && ar->dimen > 1)\n+\t {\n+\t for (i = 0; i < ar->dimen - 1; i++)\n+\t\t{\n+\t\t if ((ar->start[i] && ar->as->lower[i]\n+\t\t && gfc_dep_compare_expr (ar->start[i], ar->as->lower[i])\n+\t\t != 0)\n+\t\t || (ar->end[i] && ar->as->upper[i]\n+\t\t\t && gfc_dep_compare_expr (ar->end[i], ar->as->upper[i])\n+\t\t\t != 0))\n+\t\t {\n+\t\t do_warn = true;\n+\t\t break;\n+\t\t }\n+\t\t}\n+\t }\n+\t}\n+ if (do_warn)\n+\tgfc_warning (0, \"Assignment to contiguous pointer from \"\n+\t\t \"possibly non-contiguous target at %L\",\n+\t\t &rvalue->where);\n+ }\n+\n /* Warn if it is the LHS pointer may lives longer than the RHS target. */\n if (warn_target_lifetime\n && rvalue->expr_type == EXPR_VARIABLE\n", "prefixes": [ "fortran" ] }