public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-2652] libgomp: Appease some static analyzers [PR106906]
@ 2022-09-13 17:04 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2022-09-13 17:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:e11babbfac21163118b69dd25b468ade80dbe8de

commit r13-2652-ge11babbfac21163118b69dd25b468ade80dbe8de
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Sep 13 19:00:02 2022 +0200

    libgomp: Appease some static analyzers [PR106906]
    
    While icv_addr[1] = false; assignments where icv_addr has void *
    element type is correct and matches how it is used (in those cases
    the void * pointer is then cast to bool and used that way), there is no
    reason not to add explicit (void *) casts there which are there already
    for (void *) true.  And, there is in fact even no point in actually
    doing those stores at all because we set that pointer to NULL a few
    lines earlier.  So, this patch adds the explicit casts and then
    comments those out to show intent.
    
    2022-09-13  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.

Diff:
---
 libgomp/env.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libgomp/env.c b/libgomp/env.c
index ac8c764db60..0249966e8a6 100644
--- a/libgomp/env.c
+++ b/libgomp/env.c
@@ -1892,14 +1892,14 @@ get_icv_member_addr (struct gomp_initial_icvs *icvs, int icv_code,
     {
     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_icvs *icvs, int icv_code,
       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:

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-13 17:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 17:04 [gcc r13-2652] libgomp: Appease some static analyzers [PR106906] Jakub Jelinek

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).