[committed,libgomp,amdgcn] Fix plugin-gcn.c bug
diff mbox series

Message ID b4733c3a-7555-816d-9290-18a8bad1e52b@codesourcery.com
State New
Headers show
Series
  • [committed,libgomp,amdgcn] Fix plugin-gcn.c bug
Related show

Commit Message

Andrew Stubbs Jan. 23, 2020, 12:46 p.m. UTC
I've committed this patch to fix a bug in the OpenMP argument parsing.

It was using a value instead of a mask to read from the arguments. Since 
the value in question happens to be zero, the comparison would always 
return true. I've not observed any bad behaviour from this, but in 
theory it could read attempt to read any unhandled argument as the 
thread limit.

Andrew

Patch
diff mbox series

Fix libgomp plugin-gcn bug

2020-01-23  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* plugin/plugin-gcn.c (parse_target_attributes): Use correct mask for
	the device id.

diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c
index de470a3dd33..7854c142f05 100644
--- a/libgomp/plugin/plugin-gcn.c
+++ b/libgomp/plugin/plugin-gcn.c
@@ -1228,7 +1228,8 @@  parse_target_attributes (void **input,
 	  grid_attrs_found = true;
 	  break;
 	}
-      else if ((id & GOMP_TARGET_ARG_DEVICE_ALL) == GOMP_TARGET_ARG_DEVICE_ALL)
+      else if ((id & GOMP_TARGET_ARG_DEVICE_MASK)
+	       == GOMP_TARGET_ARG_DEVICE_ALL)
 	{
 	  gcn_dims_found = true;
 	  switch (id & GOMP_TARGET_ARG_ID_MASK)