From: Jakub Jelinek <jakub@redhat.com>
To: Tobias Burnus <tobias@codesourcery.com>, Martin Jambor <mjambor@suse.cz>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [Patch] omp-grid.c – add cast to silence different enumeration types warning
Date: Fri, 3 Apr 2020 11:08:00 +0200 [thread overview]
Message-ID: <20200403090800.GY2212@tucnak> (raw)
In-Reply-To: <449b24ed-5395-1050-4c31-4a17807688cc@codesourcery.com>
On Fri, Apr 03, 2020 at 11:02:13AM +0200, Tobias Burnus wrote:
> Those are all for the same switch statement;
>
> gomp_for contains 'tree clauses' and this clauses's '->code' is used
> to handle store 'enum omp_clauses_code' values in in gimple.{h,c}.
>
> I think adding this cast (and only this one) makes sense and it
> also silences a (clang) compiler warning.
That looks wrong to me. If *pc are OMP_CLAUSES, then it should use
OMP_CLAUSE_CODE (c) instead of TREE_CODE (c).
If something creates a tree that has TREE_CODE OMP_CLAUSE_LINEAR, then
that looks very suspicios (TREE_CODE should be OMP_CLAUSE).
> omp-grid.c – add cast to silence different enumeration types warning
>
> * omp-grid.c (grid_eliminate_combined_simd_part): Add cast
> to omp_clause_code to silence compiler warning.
>
> diff --git a/gcc/omp-grid.c b/gcc/omp-grid.c
> index b98e45de6a0..878977da2f9 100644
> --- a/gcc/omp-grid.c
> +++ b/gcc/omp-grid.c
> @@ -1058,21 +1058,21 @@ grid_eliminate_combined_simd_part (gomp_for *parloop)
> while (*tgt)
> tgt = &OMP_CLAUSE_CHAIN (*tgt);
>
> /* Copy over all clauses, except for linear clauses, which are turned into
> private clauses, and all other simd-specific clauses, which are
> ignored. */
> tree *pc = gimple_omp_for_clauses_ptr (simd);
> while (*pc)
> {
> tree c = *pc;
> - switch (TREE_CODE (c))
> + switch ((omp_clause_code) TREE_CODE (c))
> {
> case OMP_CLAUSE_LINEAR:
> {
> tree priv = build_omp_clause (UNKNOWN_LOCATION, OMP_CLAUSE_PRIVATE);
> OMP_CLAUSE_DECL (priv) = OMP_CLAUSE_DECL (c);
> OMP_CLAUSE_CHAIN (priv) = NULL;
> *tgt = priv;
> tgt = &OMP_CLAUSE_CHAIN (priv);
> pc = &OMP_CLAUSE_CHAIN (c);
> break;
Jakub
next prev parent reply other threads:[~2020-04-03 9:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-03 9:02 Tobias Burnus
2020-04-03 9:08 ` Jakub Jelinek [this message]
2020-04-03 10:43 ` [Patch] HSA: omp-grid.c – access proper clause code (was: Re: [Patch] omp-grid.c – add cast to silence different enumeration types warning) Tobias Burnus
2020-04-06 12:32 ` Jakub Jelinek
2020-04-09 17:46 ` Martin Jambor
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=20200403090800.GY2212@tucnak \
--to=jakub@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=mjambor@suse.cz \
--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).