public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Marcel Vollweiler <marcel@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, Tobias Burnus <tobias@codesourcery.com>
Subject: [committed] libgomp: Fix up OMP_PROC_BIND handling [PR106894]
Date: Fri, 9 Sep 2022 13:50:26 +0200	[thread overview]
Message-ID: <YxsognvVm2JUJuQ8@tucnak> (raw)
In-Reply-To: <7dc0eaf0-a3ed-8145-c43a-e9bb063f6acd@codesourcery.com>

On Wed, Aug 31, 2022 at 12:56:25PM +0200, Marcel Vollweiler wrote:
> +	  case PARSE_BIND:
> +	    *(char *) (host_envvars[omp_var].dest[0])
> +		  = *(char *) params[0];
> +	    *(char *) (host_envvars[omp_var].dest[1])
> +		  = *(char *) params[1];
> +	    *(unsigned long *) (host_envvars[omp_var].dest[2])
> +		  = *(unsigned long *) params[2];

While the first param is char (gomp_global_icv.bind_var), the second param
is char * (gomp_bind_var_list), so we shouldn't access it through *(char *).

Tested on x86_64-linux with
make check RUNTESTFLAGS="c.exp='*affinity* icv-6.c *display*' c++.exp='*affinity* icv-6.c *display*' fortran.exp='*affinity*'"
which previously had various failures, committed to trunk.

2022-09-09  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/106894
	* env.c (initialize_env) <case PARSE_BIND>: Use char ** instead of
	char * for dest[1] initialization from params[1].  Formatting fixes.

--- libgomp/env.c.jj	2022-09-08 20:22:07.849183684 +0200
+++ libgomp/env.c	2022-09-09 13:30:14.090107492 +0200
@@ -2184,12 +2184,10 @@ initialize_env (void)
 	    *(int *) (host_envvars[omp_var].dest[1]) = *(int *) params[1];
 	    break;
 	  case PARSE_BIND:
-	    *(char *) (host_envvars[omp_var].dest[0])
-		  = *(char *) params[0];
-	    *(char *) (host_envvars[omp_var].dest[1])
-		  = *(char *) params[1];
+	    *(char *) (host_envvars[omp_var].dest[0]) = *(char *) params[0];
+	    *(char **) (host_envvars[omp_var].dest[1]) = *(char **) params[1];
 	    *(unsigned long *) (host_envvars[omp_var].dest[2])
-		  = *(unsigned long *) params[2];
+	      = *(unsigned long *) params[2];
 	    break;
 	  }
       }


	Jakub


      parent reply	other threads:[~2022-09-09 11:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18 15:22 OpenMP, libgomp: Environment variable syntax extension Marcel Vollweiler
2022-01-18 16:10 ` [PATCH] " Marcel Vollweiler
2022-05-04 15:12   ` Jakub Jelinek
2022-05-04 15:52     ` Tobias Burnus
2022-06-10 13:59     ` Marcel Vollweiler
2022-06-30 11:40       ` Jakub Jelinek
2022-06-30 13:21         ` Jakub Jelinek
2022-06-30 17:13           ` Jakub Jelinek
2022-07-04 15:14         ` Jakub Jelinek
2022-07-25 13:38         ` Marcel Vollweiler
2022-08-02  7:52           ` Marcel Vollweiler
2022-08-22 15:35             ` Jakub Jelinek
2022-08-31 10:56               ` Marcel Vollweiler
2022-09-06 11:51                 ` Jakub Jelinek
2022-09-09 20:50                   ` Rainer Orth
2022-09-09 22:08                     ` Jakub Jelinek
2022-09-09 22:13                       ` Iain Sandoe
2022-09-09 22:17                         ` Jakub Jelinek
2022-09-10 13:17                           ` Iain Sandoe
2022-09-09 11:50                 ` Jakub Jelinek [this message]

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=YxsognvVm2JUJuQ8@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=marcel@codesourcery.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).