]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Print an error message instead of asserting when the count argument of pthread_barrie...
authorBart Van Assche <bvanassche@acm.org>
Mon, 17 Nov 2008 17:35:26 +0000 (17:35 +0000)
committerBart Van Assche <bvanassche@acm.org>
Mon, 17 Nov 2008 17:35:26 +0000 (17:35 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8776

drd/drd_barrier.c

index 542c610b0eb515fd09bf68fdc3dd8537e3030628..fd4ecfa3b1820fcafebfcdb5deaa64c64a0eb09d 100644 (file)
@@ -99,7 +99,6 @@ void barrier_initialize(struct barrier_info* const p,
 {
   tl_assert(barrier != 0);
   tl_assert(barrier_type == pthread_barrier || barrier_type == gomp_barrier);
-  tl_assert(count > 0);
   tl_assert(p->a1 == barrier);
 
   p->cleanup           = (void(*)(DrdClientobj*))barrier_cleanup;
@@ -185,6 +184,16 @@ void barrier_init(const Addr barrier,
 
   tl_assert(barrier_type == pthread_barrier || barrier_type == gomp_barrier);
 
+  if (count == 0)
+  {
+    BarrierErrInfo bei = { barrier };
+    VG_(maybe_record_error)(VG_(get_running_tid)(),
+                            BarrierErr,
+                            VG_(get_IP)(VG_(get_running_tid)()),
+                            "pthread_barrier_init: 'count' argument is zero",
+                            &bei);
+  }
+
   if (! reinitialization && barrier_type == pthread_barrier)
   {
     p = barrier_get(barrier);
@@ -194,7 +203,7 @@ void barrier_init(const Addr barrier,
       VG_(maybe_record_error)(VG_(get_running_tid)(),
                               BarrierErr,
                               VG_(get_IP)(VG_(get_running_tid)()),
-                              "Barrier reinitializatoin",
+                              "Barrier reinitialization",
                               &bei);
     }
   }