get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/2216470/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2216470,
    "url": "http://patchwork.ozlabs.org/api/patches/2216470/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/CAGkQGiLcjJc=My+1EtLsASR5WHVDUfdB7KaPm4o_5rKXPFeS_A@mail.gmail.com/",
    "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": "<CAGkQGiLcjJc=My+1EtLsASR5WHVDUfdB7KaPm4o_5rKXPFeS_A@mail.gmail.com>",
    "list_archive_url": null,
    "date": "2026-03-26T14:16:29",
    "name": "[fortran] PR114021 -ICE with allocation of scalar pointer entity where SOURCE=f() with f() returning a pointer",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "ae7fd61f2d814eace740d797b36a00cca86441c0",
    "submitter": {
        "id": 4392,
        "url": "http://patchwork.ozlabs.org/api/people/4392/?format=api",
        "name": "Paul Richard Thomas",
        "email": "paul.richard.thomas@gmail.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/CAGkQGiLcjJc=My+1EtLsASR5WHVDUfdB7KaPm4o_5rKXPFeS_A@mail.gmail.com/mbox/",
    "series": [
        {
            "id": 497597,
            "url": "http://patchwork.ozlabs.org/api/series/497597/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=497597",
            "date": "2026-03-26T14:16:29",
            "name": "[fortran] PR114021 -ICE with allocation of scalar pointer entity where SOURCE=f() with f() returning a pointer",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/497597/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2216470/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2216470/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=cDu6YB7J;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)",
            "sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=cDu6YB7J",
            "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com",
            "sourceware.org; spf=pass smtp.mailfrom=gmail.com",
            "server2.sourceware.org;\n arc=pass smtp.remote-ip=74.125.82.41"
        ],
        "Received": [
            "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhQpD6RqYz1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 01:17:24 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id F3D2C4BA902C\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 14:17:22 +0000 (GMT)",
            "from mail-dl1-f41.google.com (mail-dl1-f41.google.com\n [74.125.82.41])\n by sourceware.org (Postfix) with ESMTPS id 6378D4BA23CA\n for <gcc-patches@gcc.gnu.org>; Thu, 26 Mar 2026 14:16:43 +0000 (GMT)",
            "by mail-dl1-f41.google.com with SMTP id\n a92af1059eb24-128e4d0cc48so1270439c88.1\n for <gcc-patches@gcc.gnu.org>; Thu, 26 Mar 2026 07:16:43 -0700 (PDT)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org F3D2C4BA902C",
            "OpenDKIM Filter v2.11.0 sourceware.org 6378D4BA23CA"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 6378D4BA23CA",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 6378D4BA23CA",
        "ARC-Seal": [
            "i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1774534603; cv=pass;\n b=tyib3VrYC0phSfG7qA3CduNmSvvgyVyBlKhvnQdXq21LTf2dabd3rHUj8ctYVJjYFZZ1g8vswBN4kvhPILM2EJ8qnMBkpkHFP/lhI4j0kGLgsosqd69zsgAPaEy3M3KpM1fg44iisH0MnCZmjZW1wBlTBhXI0iIDY/GLwTkZCBw=",
            "i=1; a=rsa-sha256; t=1774534602; cv=none;\n d=google.com; s=arc-20240605;\n b=W7Zyzp4aF7MlIr9CsXxx/yiG7TwDc6fOl5NIM56r4l3archD/miUiFzxuz6P1oQz0f\n 3KQdnTFJyp/g7oVXQoPprv/NeEkSADhj7M7PKGzB7R3JNgyH5JRn//KWaIchsFkpyibA\n hocgsNKVbu/YsZkJHaFtt8c1KE2+IDnv5qiWUjQTk1P2dCHzbtvAf3BTzE/oA08oCG3h\n eh1IxIqxYr3U1dvdXlMSVoen5Ib0thXymaUtW88FEtvtkvePi6oPrwQi9KTwbEAZrp77\n eRwqQ4sf+98W9lh+rjJ7g817DX5dB0APVAfMQ87yInTtNWr/pkB498rqQwd8gbwHmjZM\n MEOQ=="
        ],
        "ARC-Message-Signature": [
            "i=2; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774534603; c=relaxed/simple;\n bh=9nrt4qVup5daMI8sB7+K+c6Xzoe/RxF4+zsRqievQqs=;\n h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;\n b=IaP5VIwipendCxTJpaYvyPExqpg2psh1hqzbEh4+pz9owYRjAN5EjSHEZLlcS5DbRv6txoTgqI3QrSOGjqXUrFuhf49Zx1/bduxHEFg21pQXRCJj6CKzFdLp6vRLNxJ9zzXyU/l5KDFRsgPc2Dpd8b04u7vZ6TpqsmzGIgvBrUI=",
            "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=cc:to:subject:message-id:date:from:mime-version:dkim-signature;\n bh=5yEJBu52e0g8VVViG4Vg1H/A2jkxx7B8UZ4s3o1g04A=;\n fh=bfhBuGCeXBjWp0Lg/Eat2j8quQ943TiHZVwFWeGqArg=;\n b=ewUIVJOHf7XKJa3teY2OtgUtWzeA2n/378dBGHvRPuk04CTEgA1ZBAQIdL45LsbbUC\n LdIEt/8YrofyD0+tOOqlhv9wMbfYLSy4y21m1dsBDcVZ/aREqlKtrCeHSFr2dJ03VaRS\n BUxrTCadg8Y+iWjM5ijmnCAzXTc2glt7RaN/Ha7OjEx2NGKiTG2jF1CAiV6LtlB6j2Zy\n 98YCMrAtopyyQLHjsfpN3ogfhMTckaO5qsbXPelwDDBNBk8kFOETaibORfq1ScyZNsZD\n JSUj3rD0vJBhnK/MAdIm4MglNTjAGNLAGeEWjuPq+qEHlPSnk5tZa149ED/AQEf8BV6x\n ZVxA==; darn=gcc.gnu.org"
        ],
        "ARC-Authentication-Results": [
            "i=2; server2.sourceware.org",
            "i=1; mx.google.com; arc=none"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1774534602; x=1775139402; darn=gcc.gnu.org;\n h=cc:to:subject:message-id:date:from:mime-version:from:to:cc:subject\n :date:message-id:reply-to;\n bh=5yEJBu52e0g8VVViG4Vg1H/A2jkxx7B8UZ4s3o1g04A=;\n b=cDu6YB7JFcRrxy7nXrF7kpYU3R4eMhBvIyIQYSiXf5livbyVfjYiudAL88rI0XnP49\n S/xLa9AHFQzw9e7lRE8sW58LoxJmh39rkKIG5wsBxDT8j9RKplv+bIznqHE5UJclyVeH\n ZsgTnNRgZRBPuIBBLm7VX3DKCED997/gyS07n+LE1Oc2aMIt3Xoo5UEnY+5sxPvj5k+E\n j0L21fvI0gCr5+aiSLUoyRXySnilib/y+9D1sRZMPAmZYcMtS2+c2+njqwEbRCxQ8zFH\n 2iW0OdyK9G5fPQr+P+OseDenKy/sATwmdznWdZzhV4GqNMfzlHTLkZsxLyISGIbcyILl\n dOjw==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1774534602; x=1775139402;\n h=cc:to:subject:message-id:date:from:mime-version:x-gm-gg\n :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;\n bh=5yEJBu52e0g8VVViG4Vg1H/A2jkxx7B8UZ4s3o1g04A=;\n b=sz5iHD7yvVV2+bE1/Q5yC2LH7PS242lF8KiEEEbAVgKut7x0roJ4Oac+xtB74hIRcQ\n djYhfAl2X2X37B0cDdOP2IMxa+5gTCNElvuArcK571oP/mk6llyH/Y9pF6EwBEKsNFbb\n o72FwS9DildeXfGgzu5pVwxMJIiiig5cAtYdez7ckzZQiyh4Y+ARE/MUdkshrOhAFo/B\n DOTLbbdr++MgK3JVL4t1HOrUDTWzZxlM5M2LdcfWFHRrxv+iOVAAlC+WbXOkZeltgG/G\n oQRvPEDuhn7y7N359W/D4CbgqG/9lpjHF72akpwWcY3+FrvRitc5VjcY2XLPypPUpvgW\n q0Lw==",
        "X-Forwarded-Encrypted": "i=1;\n AJvYcCURYxXXktyZiZF806tGJm0kcKJlKXbVmRtug57udNoBXLlHYyN7yRbcoOh3FIkMgHYRkea1CL9XqLF0Cg==@gcc.gnu.org",
        "X-Gm-Message-State": "AOJu0YzwQ4TUBysr+QDXJLzWZNkflXW2aRdywD3W1OwQSzD89RxE0+oz\n bCIPtwvxUuxDJTAwYvrqt5nrUQUYyRI7a65WnQ1UjWukghFDa/xh0tm1Vzy6oaxpFzau+zeA29i\n YwxjpE3oI7VTZfeJTg++QYcb7Qg8H62w=",
        "X-Gm-Gg": "ATEYQzw2GZ2qtyX/m/DqLsRZhFAKx7E7q4SMTEBEVoeNANX2T1m9RwhF34fmjCpFS29\n e3eECx0DURxHNq8n2kfA0SOmh9zoVnYGVyUcRwO3o+1TZe9LSZVFAmO8UylclRC1BglmCxhp7CT\n YzlxBwPdi9uqsCe/WKZzrAtiUmIErbc/nKg/bh6fo39cFEUvI+1l8mwfpmT+z2XTs2hXkw1Dcie\n 5UdMSOlncHwdP3AL6EMerd0josl5uSF+EM9p4gzZnqi+A51vfW8eteE3sg4HJ9jp3Zr3aKlmmq7\n fJljEcFWb481t0eXLUdQhqNPbOF5toxmyJDwwQ8RwA==",
        "X-Received": "by 2002:a05:7022:384a:b0:11b:e21e:5653 with SMTP id\n a92af1059eb24-12a96ecf157mr3801689c88.19.1774534602060; Thu, 26 Mar 2026\n 07:16:42 -0700 (PDT)",
        "MIME-Version": "1.0",
        "From": "Paul Richard Thomas <paul.richard.thomas@gmail.com>",
        "Date": "Thu, 26 Mar 2026 14:16:29 +0000",
        "X-Gm-Features": "AQROBzBAJKflH1e29Qpa3adKOxTulPlgCwkI6Am2R87i6jUeWLjf1JJ6vIBbde8",
        "Message-ID": "\n <CAGkQGiLcjJc=My+1EtLsASR5WHVDUfdB7KaPm4o_5rKXPFeS_A@mail.gmail.com>",
        "Subject": "[Patch, fortran] PR114021 -ICE with allocation of scalar pointer\n entity where SOURCE=f() with f() returning a pointer",
        "To": "\"fortran@gcc.gnu.org\" <fortran@gcc.gnu.org>,\n gcc-patches <gcc-patches@gcc.gnu.org>",
        "Cc": "Harald Anlauf <anlauf@gmx.de>",
        "Content-Type": "multipart/mixed; boundary=\"000000000000999a3a064dee084d\"",
        "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>,\n <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>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "Hello All,\n\nThanks to Harald for pointing out this low hanging fruit to me.\n\nThe original ICE has changed to one that is easily identified and\nfixed: dereferencing a NULL pointer in trans_allocate. This is fixed\nin the third chunk. In this case, a symtree is now provided by  a\nmodified version of gfc_get_unique symtree, which is the content of\nthe first chunk. Also, deallocation of non-variable, pointer source\nallocatable components has been suppressed in the second chunk.\n\nThe resulting behaviour of the testcase has been tested against that\nof other brands, since it wasn't evident to me from reading the F2018\nstandard that the deep copy of the allocatable component is correct.\n\nRegtested on FC43/x86_64 - OK for mainline?\n\nPaul",
    "diff": "diff --git a/gcc/fortran/symbol.cc b/gcc/fortran/symbol.cc\nindex 32d12600a19..e1b49b0ba0d 100644\n--- a/gcc/fortran/symbol.cc\n+++ b/gcc/fortran/symbol.cc\n@@ -3206,7 +3206,15 @@ gfc_get_unique_symtree (gfc_namespace *ns)\n   static int serial = 0;\n \n   sprintf (name, \"@%d\", serial++);\n-  return gfc_new_symtree (&ns->sym_root, name);\n+  if (ns)\n+    return gfc_new_symtree (&ns->sym_root, name);\n+  else\n+    {\n+      /* Some uses need a symtree that is cleaned up locally.  */\n+      gfc_symtree *st = XCNEW (gfc_symtree);\n+      st->name = gfc_get_string (\"%s\", name);\n+      return st;\n+    }\n }\n \n \ndiff --git a/gcc/fortran/trans-stmt.cc b/gcc/fortran/trans-stmt.cc\nindex 4d2ca182f80..49f8cd8d7ac 100644\n--- a/gcc/fortran/trans-stmt.cc\n+++ b/gcc/fortran/trans-stmt.cc\n@@ -6923,6 +6923,7 @@ gfc_trans_allocate (gfc_code * code, gfc_omp_namelist *omp_allocate)\n \t  && (code->expr3->ts.u.derived->attr.alloc_comp\n \t      || code->expr3->ts.u.derived->attr.pdt_type)\n \t  && !code->expr3->must_finalize\n+\t  && !gfc_expr_attr (code->expr3).pointer\n \t  && !code->ext.alloc.expr3_not_explicit)\n \t{\n \t  tmp = gfc_deallocate_alloc_comp (code->expr3->ts.u.derived,\n@@ -7086,11 +7087,16 @@ gfc_trans_allocate (gfc_code * code, gfc_omp_namelist *omp_allocate)\n \t  /* Build a temporary symtree and symbol.  Do not add it to the current\n \t     namespace to prevent accidentaly modifying a colliding\n \t     symbol's as.  */\n-\t  newsym = XCNEW (gfc_symtree);\n \t  /* The name of the symtree should be unique, because gfc_create_var ()\n \t     took care about generating the identifier.  */\n-\t  newsym->name\n-\t    = gfc_get_string (\"%s\", IDENTIFIER_POINTER (DECL_NAME (expr3)));\n+\t  if (DECL_NAME (expr3) && IDENTIFIER_POINTER (DECL_NAME (expr3)))\n+\t    {\n+\t      const char *name = IDENTIFIER_POINTER (DECL_NAME (expr3));\n+\t      newsym = XCNEW (gfc_symtree);\n+\t      newsym->name = gfc_get_string (\"%s\", name);\n+\t    }\n+\t  else\n+\t    newsym = gfc_get_unique_symtree (NULL);\n \t  newsym->n.sym = gfc_new_symbol (newsym->name, NULL);\n \t  /* The backend_decl is known.  It is expr3, which is inserted\n \t     here.  */\ndiff --git a/gcc/testsuite/gfortran.dg/pr114021.f90 b/gcc/testsuite/gfortran.dg/pr114021.f90\nnew file mode 100644\nindex 00000000000..aa28979e374\n--- /dev/null\n+++ b/gcc/testsuite/gfortran.dg/pr114021.f90\n@@ -0,0 +1,51 @@\n+! { dg-do run }\n+!\n+! Test the fix for PR114021 in which the ALLOCATE statement caused an ICE.\n+! The test checks that f() is called once per allocation, that the result\n+! of the allocation is correct and that a deep copy of w%x1 has been effected\n+! in 's2' without freeing it.\n+!\n+! Contributed by Steve Kargl  <kargl@gcc.gnu.org>\n+!\n+module m1\n+   type y\n+      integer, allocatable:: x1(:)\n+   end type\n+   type(y), target :: w\n+   integer :: c = 0\n+contains\n+   function f()\n+      type(y), pointer :: f\n+      f => w\n+      c = c + 1\n+   end function\n+end\n+\n+subroutine s1\n+   use m1\n+   type(y), allocatable :: x\n+   allocate(x, source = f())\n+   if ((c /= 1) .or. (allocated (x%x1))) stop 1\n+end\n+\n+subroutine s2\n+   use m1\n+   type(y), pointer :: x\n+   allocate(x, source = f())\n+   if ((c /= 2) .or. (.not.allocated (x%x1))) stop 2\n+   if (any (abs (x%x1 - [3.0,4.0]) > 1e-6)) stop 3\n+   x%x1 = [5.0,6.0]\n+   if (allocated (x%x1)) deallocate (x%x1)\n+   if (associated (x)) deallocate (x)\n+end\n+\n+   use m1\n+   call s1\n+   w%x1 = [1.0,2.0]\n+   if (c /= 1) stop 1\n+   w%x1 = [3.0,4.0]\n+   call s2\n+   if (c /= 2) stop 2\n+   if (.not.allocated (w%x1) .or. any (abs (w%x1 - [3.0,4.0]) > 1e-6)) stop 4\n+   if (allocated (w%x1)) deallocate (w%x1)\n+end\n",
    "prefixes": [
        "fortran"
    ]
}