vcomp: Handle begin == NULL in _vcomp_for_static_init.

Signed-off-by: Sebastian Lackner <sebastian@fds-team.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Sebastian Lackner 2017-04-24 16:12:43 +02:00 committed by Alexandre Julliard
parent 11a1ceebc3
commit b228f16c0d
2 changed files with 55 additions and 0 deletions

View File

@ -1171,10 +1171,17 @@ void CDECL _vcomp_for_static_init(int first, int last, int step, int chunksize,
struct vcomp_team_data *team_data = thread_data->team;
int num_threads = team_data ? team_data->num_threads : 1;
int thread_num = thread_data->thread_num;
int no_begin, no_lastchunk;
TRACE("(%d, %d, %d, %d, %p, %p, %p, %p, %p)\n",
first, last, step, chunksize, loops, begin, end, next, lastchunk);
if (!begin)
{
begin = &no_begin;
lastchunk = &no_lastchunk;
}
if (num_threads == 1 && chunksize != 1)
{
*loops = 1;

View File

@ -1002,6 +1002,30 @@ static void CDECL for_static_cb(void)
p_vcomp_for_static_end();
p_vcomp_barrier();
loops = end = next = lastchunk = 0xdeadbeef;
p_vcomp_for_static_init(tests[i].first, tests[i].last, tests[i].step, tests[i].chunksize,
&loops, NULL, &end, &next, &lastchunk);
if (broken_flags & VCOMP_FOR_STATIC_BROKEN_LOOP)
{
ok(loops == 0 || loops == 1, "test %d, thread %d/%d: expected loops == 0 or 1, got %u\n",
i, thread_num, num_threads, loops);
}
else
{
ok(loops == my_loops, "test %d, thread %d/%d: expected loops == %u, got %u\n",
i, thread_num, num_threads, my_loops, loops);
ok(end == my_end, "test %d, thread %d/%d: expected end == %d, got %d\n",
i, thread_num, num_threads, my_end, end);
ok(next == my_next || broken(broken_flags & VCOMP_FOR_STATIC_BROKEN_NEXT),
"test %d, thread %d/%d: expected next == %d, got %d\n", i, thread_num, num_threads, my_next, next);
ok(lastchunk == 0xdeadbeef, "test %d, thread %d/%d: expected lastchunk == 0xdeadbeef, got %d\n",
i, thread_num, num_threads, lastchunk);
}
p_vcomp_for_static_end();
p_vcomp_barrier();
if (tests[i].first == tests[i].last) continue;
my_loops = my_begin = my_end = my_next = my_lastchunk = 0xdeadbeef;
@ -1032,6 +1056,30 @@ static void CDECL for_static_cb(void)
p_vcomp_for_static_end();
p_vcomp_barrier();
loops = end = next = lastchunk = 0xdeadbeef;
p_vcomp_for_static_init(tests[i].last, tests[i].first, tests[i].step, tests[i].chunksize,
&loops, NULL, &end, &next, &lastchunk);
if (broken_flags & VCOMP_FOR_STATIC_BROKEN_LOOP)
{
ok(loops == 0 || loops == 1, "test %d, thread %d/%d: expected loops == 0 or 1, got %u\n",
i, thread_num, num_threads, loops);
}
else
{
ok(loops == my_loops, "test %d, thread %d/%d: expected loops == %u, got %u\n",
i, thread_num, num_threads, my_loops, loops);
ok(end == my_end, "test %d, thread %d/%d: expected end == %d, got %d\n",
i, thread_num, num_threads, my_end, end);
ok(next == my_next || broken(broken_flags & VCOMP_FOR_STATIC_BROKEN_NEXT),
"test %d, thread %d/%d: expected next == %d, got %d\n", i, thread_num, num_threads, my_next, next);
ok(lastchunk == 0xdeadbeef, "test %d, thread %d/%d: expected lastchunk == 0xdeadbeef, got %d\n",
i, thread_num, num_threads, lastchunk);
}
p_vcomp_for_static_end();
p_vcomp_barrier();
}
}