Commit b228f16c authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

vcomp: Handle begin == NULL in _vcomp_for_static_init.

parent 11a1ceeb
...@@ -1171,10 +1171,17 @@ void CDECL _vcomp_for_static_init(int first, int last, int step, int chunksize, ...@@ -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; struct vcomp_team_data *team_data = thread_data->team;
int num_threads = team_data ? team_data->num_threads : 1; int num_threads = team_data ? team_data->num_threads : 1;
int thread_num = thread_data->thread_num; int thread_num = thread_data->thread_num;
int no_begin, no_lastchunk;
TRACE("(%d, %d, %d, %d, %p, %p, %p, %p, %p)\n", TRACE("(%d, %d, %d, %d, %p, %p, %p, %p, %p)\n",
first, last, step, chunksize, loops, begin, end, next, lastchunk); first, last, step, chunksize, loops, begin, end, next, lastchunk);
if (!begin)
{
begin = &no_begin;
lastchunk = &no_lastchunk;
}
if (num_threads == 1 && chunksize != 1) if (num_threads == 1 && chunksize != 1)
{ {
*loops = 1; *loops = 1;
......
...@@ -1002,6 +1002,30 @@ static void CDECL for_static_cb(void) ...@@ -1002,6 +1002,30 @@ static void CDECL for_static_cb(void)
p_vcomp_for_static_end(); p_vcomp_for_static_end();
p_vcomp_barrier(); 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; if (tests[i].first == tests[i].last) continue;
my_loops = my_begin = my_end = my_next = my_lastchunk = 0xdeadbeef; my_loops = my_begin = my_end = my_next = my_lastchunk = 0xdeadbeef;
...@@ -1032,6 +1056,30 @@ static void CDECL for_static_cb(void) ...@@ -1032,6 +1056,30 @@ static void CDECL for_static_cb(void)
p_vcomp_for_static_end(); p_vcomp_for_static_end();
p_vcomp_barrier(); 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();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment