Sebastian Lackner : vcomp: Handle begin == NULL in _vcomp_for_static_init.

Alexandre Julliard julliard at winehq.org
Mon Apr 24 16:11:23 CDT 2017


Module: wine
Branch: master
Commit: b228f16c0d020a3d8219668a64204bc57b3aa78d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b228f16c0d020a3d8219668a64204bc57b3aa78d

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Mon Apr 24 16:12:43 2017 +0200

vcomp: Handle begin == NULL in _vcomp_for_static_init.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/vcomp/main.c        |  7 +++++++
 dlls/vcomp/tests/vcomp.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index 34e327e..5206e47 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -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;
diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
index f0d8b3a..9aec5cc 100644
--- a/dlls/vcomp/tests/vcomp.c
+++ b/dlls/vcomp/tests/vcomp.c
@@ -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();
     }
 }
 




More information about the wine-cvs mailing list