public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Tobias Burnus <tobias@codesourcery.com>,
	David Malcolm <dmalcolm@redhat.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch] OpenMP (C only): omp allocate - extend parsing support, improve diagnostic (was: [Patch] OpenMP (C only): omp allocate - handle stack vars, improve diagnostic)
Date: Mon, 11 Sep 2023 13:54:26 +0200	[thread overview]
Message-ID: <ZP7/8tWcYGoS6aTN@tucnak> (raw)
In-Reply-To: <e368e8e6-1032-2dca-4a73-7c556b10d7f7@codesourcery.com>

Hi!

One question to David below, CCed.

On Mon, Sep 11, 2023 at 01:44:07PM +0200, Tobias Burnus wrote:
> --- a/gcc/c/c-decl.cc
> +++ b/gcc/c/c-decl.cc
> @@ -681,6 +681,11 @@ decl_jump_unsafe (tree decl)
>    if (VAR_P (decl) && C_DECL_COMPOUND_LITERAL_P (decl))
>      return false;
>  
> +  if (flag_openmp
> +      && VAR_P (decl)
> +      && lookup_attribute ("omp allocate", DECL_ATTRIBUTES (decl)))
> +    return true;
> +
>    /* Always warn about crossing variably modified types.  */
>    if ((VAR_P (decl) || TREE_CODE (decl) == TYPE_DECL)
>        && c_type_variably_modified_p (TREE_TYPE (decl)))
> @@ -724,6 +729,12 @@ c_print_identifier (FILE *file, tree node, int indent)
>    c_binding_oracle = save;
>  }
>  

I think we want a function comment here.

> +void
> +c_mark_decl_jump_unsafe_in_current_scope ()
> +{
> +  current_scope->has_jump_unsafe_decl = 1;
> +}
> +
> +	  if (DECL_SOURCE_LOCATION (allocator) > DECL_SOURCE_LOCATION (var))
> +	    {
> +	      error_at (OMP_CLAUSE_LOCATION (nl),
> +			"allocator variable %qD must be declared before %qD",
> +			allocator, var);
> +	      inform (DECL_SOURCE_LOCATION (allocator), "declared here");
> +	      inform (DECL_SOURCE_LOCATION (var), "declared here");

I think this will be confusing to users when the inform is the same in both
cases.  I'd use "allocator declared here" in the first case.

And, am really not sure if one can just simply compare location_t like that.
Isn't there some function which determines what source location is before
another one?  David?

> +		 if (EXPR_LOCATION (*l) < DECL_SOURCE_LOCATION (var))
> +		   break;

Likewise.

> --- /dev/null
> +++ b/gcc/testsuite/c-c++-common/gomp/allocate-12.c
> @@ -0,0 +1,46 @@
> +/* TODO: enable for C++ once implemented. */
> +/* { dg-do compile { target c } } */
> +
> +typedef enum omp_allocator_handle_t

I think all the c-c++-common tests declaring
omp_allocator_handle_t should have
#if __cplusplus >= 201103L
: __UINTPTR_TYPE__
#endif
here (even if they are just { target c } for now, we'd certainly
forget to adjust them).


	Jakub


  reply	other threads:[~2023-09-11 11:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-29 16:12 [Patch] OpenMP (C only): omp allocate - handle stack vars, improve diagnostic Tobias Burnus
2023-08-29 16:28 ` Jakub Jelinek
2023-08-29 16:56   ` Tobias Burnus
2023-08-29 17:14     ` Jakub Jelinek
2023-08-30 10:47       ` Tobias Burnus
2023-08-30 11:13         ` Jakub Jelinek
2023-08-30 12:43         ` Tobias Burnus
2023-09-11 11:44           ` [Patch] OpenMP (C only): omp allocate - extend parsing support, improve diagnostic (was: [Patch] OpenMP (C only): omp allocate - handle stack vars, improve diagnostic) Tobias Burnus
2023-09-11 11:54             ` Jakub Jelinek [this message]
2023-09-11 13:07               ` David Malcolm
2023-09-11 13:21               ` Tobias Burnus
2023-09-11 13:34                 ` Jakub Jelinek
2023-09-12  7:04                   ` [Patch] OpenMP (C only): omp allocate - extend parsing support, improve diagnostic Tobias Burnus
2023-09-12  7:15                     ` Jakub Jelinek
2023-09-12  8:55                     ` Tobias Burnus

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=ZP7/8tWcYGoS6aTN@tucnak \
    --to=jakub@redhat.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --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).