public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgomp/106906] libgomp/env.c: 3 * boolean value assigned to pointer
Date: Mon, 12 Sep 2022 11:33:31 +0000	[thread overview]
Message-ID: <bug-106906-4-suOiTd6Xna@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106906-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106906

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Well, it is correct as is, because while icv_addr[3] and params[3] have void *
type, they are actually cast to various types (either other pointers or bool
etc.).
But there is no need not to make the cast explicit and after all, there is
icv_addr[0] = icv_addr[1] = icv_addr[2] = NULL;
before the switch, so zero reinitialization is just a waste of time unless
compiler optimizes that out.
So we could go for:
2022-09-12  Jakub Jelinek  <jakub@redhat.com>

        PR libgomp/106906
        * env.c (get_icv_member_addr): Cast false to void * before assigning
        it to icv_addr[1], and comment the whole assignment out.

--- libgomp/env.c.jj    2022-09-12 10:32:00.935086858 +0200
+++ libgomp/env.c       2022-09-12 13:27:22.893571697 +0200
@@ -1892,14 +1892,14 @@ get_icv_member_addr (struct gomp_initial
     {
     case GOMP_ICV_NTEAMS:
       icv_addr[0] = &icvs->nteams_var;
-      icv_addr[1] = false;
+      /* icv_addr[1] = (void *) false; */
       break;
     case GOMP_ICV_DYNAMIC:
       icv_addr[0] = &(*icvs).dyn_var;
       break;
     case GOMP_ICV_TEAMS_THREAD_LIMIT:
       icv_addr[0] = &icvs->teams_thread_limit_var;
-      icv_addr[1] = false;
+      /* icv_addr[1] = (void *) false; */
       break;
     case GOMP_ICV_SCHEDULE:
       icv_addr[0] = &icvs->run_sched_var;
@@ -1907,7 +1907,7 @@ get_icv_member_addr (struct gomp_initial
       break;
     case GOMP_ICV_THREAD_LIMIT:
       icv_addr[0] = &icvs->thread_limit_var;
-      icv_addr[1] = false;
+      /* icv_addr[1] = (void *) false; */
       icv_addr[2] = (void *) UINT_MAX;
       break;
     case GOMP_ICV_NTHREADS:

  reply	other threads:[~2022-09-12 11:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 11:01 [Bug libgomp/106906] New: " dcb314 at hotmail dot com
2022-09-12 11:33 ` jakub at gcc dot gnu.org [this message]
2022-09-13 17:04 ` [Bug libgomp/106906] " cvs-commit at gcc dot gnu.org
2022-09-13 17:06 ` jakub at gcc dot gnu.org

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=bug-106906-4-suOiTd6Xna@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).