public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Schwinge <thomas@codesourcery.com>
To: Tobias Burnus <tobias@codesourcery.com>,
	<gcc-patches@gcc.gnu.org>, <fortran@gcc.gnu.org>
Cc: Jakub Jelinek <jakub@redhat.com>, Andrew MacLeod <amacleod@redhat.com>
Subject: Re: [Patch] OpenMP: Minor '!$omp allocators' cleanup - and still: Re: [patch] OpenMP/Fortran: Implement omp allocators/allocate for ptr/allocatables
Date: Mon, 11 Dec 2023 23:12:22 +0100	[thread overview]
Message-ID: <878r60s81l.fsf@euler.schwinge.homeip.net> (raw)
In-Reply-To: <16bc2d0c-7228-43f8-803b-74a980510370@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 2276 bytes --]

Hi!

This issue would've been prevented if we'd actually use a distinct C++
data type for GCC types, checkable at compile time -- I'm thus CCing
Andrew MacLeod for amusement or crying, "one more for the list!".  ;-\
(See
<https://inbox.sourceware.org/1acd7994-2440-4092-897f-97f14d3fbf45@redhat.com>
"[TTYPE] Strongly typed tree project. Original document circa 2017".)

On 2023-12-11T12:45:27+0100, Tobias Burnus <tobias@codesourcery.com> wrote:
> I included a minor cleanup patch [...]
>
> I intent to commit that patch as obvious, unless there are further comments.

> OpenMP: Minor '!$omp allocators' cleanup

> --- a/gcc/fortran/trans-openmp.cc
> +++ b/gcc/fortran/trans-openmp.cc
> @@ -8361,8 +8361,10 @@ gfc_omp_call_add_alloc (tree ptr)
>    if (fn == NULL_TREE)
>      {
>        fn = build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
> +      tree att = build_tree_list (NULL_TREE, build_string (4, ". R "));
> +      att = tree_cons (get_identifier ("fn spec"), att, TYPE_ATTRIBUTES (fn));
> +      fn = build_type_attribute_variant (fn, att);
>        fn = build_fn_decl ("GOMP_add_alloc", fn);
> -/* FIXME: attributes.  */
>      }
>    return build_call_expr_loc (input_location, fn, 1, ptr);
>  }
> @@ -8380,7 +8382,9 @@ gfc_omp_call_is_alloc (tree ptr)
>        fn = build_function_type_list (boolean_type_node, ptr_type_node,
>                                    NULL_TREE);
>        fn = build_fn_decl ("GOMP_is_alloc", fn);
> -/* FIXME: attributes.  */
> +      tree att = build_tree_list (NULL_TREE, build_string (4, ". R "));
> +      att = tree_cons (get_identifier ("fn spec"), att, TYPE_ATTRIBUTES (fn));
> +      fn = build_type_attribute_variant (fn, att);
>      }
>    return build_call_expr_loc (input_location, fn, 1, ptr);
>  }

Pushed to master branch commit 453e0f45a49f425992bc47ff8909ed8affc29d2e
"Resolve ICE in 'gcc/fortran/trans-openmp.cc:gfc_omp_call_is_alloc'", see
attached.


Grüße
 Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Resolve-ICE-in-gcc-fortran-trans-openmp.cc-gfc_omp_c.patch --]
[-- Type: text/x-diff, Size: 1744 bytes --]

From 453e0f45a49f425992bc47ff8909ed8affc29d2e Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Mon, 11 Dec 2023 22:52:54 +0100
Subject: [PATCH] Resolve ICE in
 'gcc/fortran/trans-openmp.cc:gfc_omp_call_is_alloc'

Fix-up for recent commit 2505a8b41d3b74a545755a278f3750a29c1340b6
"OpenMP: Minor '!$omp allocators' cleanup", which caused:

    {+FAIL: gfortran.dg/gomp/allocate-5.f90   -O  (internal compiler error: tree check: expected class 'type', have 'declaration' (function_decl) in gfc_omp_call_is_alloc, at fortran/trans-openmp.cc:8386)+}
    [-PASS:-]{+FAIL:+} gfortran.dg/gomp/allocate-5.f90   -O  (test for excess errors)

..., and similarly in 'libgomp.fortran/allocators-1.f90',
'libgomp.fortran/allocators-2.f90', 'libgomp.fortran/allocators-3.f90',
'libgomp.fortran/allocators-4.f90', 'libgomp.fortran/allocators-5.f90'.

	gcc/fortran/
	* trans-openmp.cc (gfc_omp_call_is_alloc): Resolve ICE.
---
 gcc/fortran/trans-openmp.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index 95184920cf7..f7c73a5d273 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -8381,10 +8381,10 @@ gfc_omp_call_is_alloc (tree ptr)
     {
       fn = build_function_type_list (boolean_type_node, ptr_type_node,
 				     NULL_TREE);
-      fn = build_fn_decl ("GOMP_is_alloc", fn);
       tree att = build_tree_list (NULL_TREE, build_string (4, ". R "));
       att = tree_cons (get_identifier ("fn spec"), att, TYPE_ATTRIBUTES (fn));
       fn = build_type_attribute_variant (fn, att);
+      fn = build_fn_decl ("GOMP_is_alloc", fn);
     }
   return build_call_expr_loc (input_location, fn, 1, ptr);
 }
-- 
2.34.1


  reply	other threads:[~2023-12-11 22:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08 16:58 Tobias Burnus
2023-12-08 12:04 ` Jakub Jelinek
2023-12-09 11:19 ` Thomas Schwinge
2023-12-09 15:14   ` Jakub Jelinek
2023-12-11 11:45     ` [Patch] OpenMP: Minor '!$omp allocators' cleanup - and still: " Tobias Burnus
2023-12-11 22:12       ` Thomas Schwinge [this message]
2023-12-11 23:45         ` Andrew MacLeod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878r60s81l.fsf@euler.schwinge.homeip.net \
    --to=thomas@codesourcery.com \
    --cc=amacleod@redhat.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=tobias@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).