Hi Jakub, hello all,
when looking at target.c, I stumbled over that code:
size_t mapnum → unsigned
if (mapnum == 0)
...
return;
if (mapnum > 0 || ....)
...
I fail to see how the latter condition can ever become false;
hence, I removed the "if" and used the if-body unconditionally,
removing some now pointless assignments.
OK?
Tobias
-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstraße 201, 80634 München / Germany
Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Alexander
Walter
libgomp/target.c: Minor cleanup
libgomp/ChangeLog:
* target.c (gomp_map_vars_internal): Remove always-true condition
and body unconditionally.
diff --git a/libgomp/target.c b/libgomp/target.c
index 3e292eb8c62..440aad6b048 100644
--- a/libgomp/target.c
+++ b/libgomp/target.c
@@ -676,28 +676,23 @@ gomp_map_vars_internal (struct gomp_device_descr *devicep,
if (mapnum == 0)
{
tgt->tgt_start = 0;
tgt->tgt_end = 0;
return tgt;
}
tgt_align = sizeof (void *);
tgt_size = 0;
- cbuf.chunks = NULL;
- cbuf.chunk_cnt = -1;
+ cbuf.chunk_cnt = 0;
cbuf.use_cnt = 0;
- cbuf.buf = NULL;
- if (mapnum > 1 || pragma_kind == GOMP_MAP_VARS_TARGET)
- {
- size_t chunks_size = (mapnum + 1) * sizeof (struct gomp_coalesce_chunk);
- cbuf.chunks = (struct gomp_coalesce_chunk *) gomp_alloca (chunks_size);
- cbuf.chunk_cnt = 0;
- }
+ size_t chunks_size = (mapnum + 1) * sizeof (struct gomp_coalesce_chunk);
+ cbuf.chunks = (struct gomp_coalesce_chunk *) gomp_alloca (chunks_size);
+
if (pragma_kind == GOMP_MAP_VARS_TARGET)
{
size_t align = 4 * sizeof (void *);
tgt_align = align;
tgt_size = mapnum * sizeof (void *);
cbuf.chunk_cnt = 1;
cbuf.use_cnt = 1 + (mapnum > 1);
cbuf.chunks[0].start = 0;
cbuf.chunks[0].end = tgt_size;