This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch, master, updated. glibc-2.10-413-g9c04f7c


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  9c04f7c155fb799fa7757b5c8bb52400d0dc2ec5 (commit)
      from  3005703bb9aff3b2a1b2cf6bbbc92e7eaf91d9a5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=9c04f7c155fb799fa7757b5c8bb52400d0dc2ec5

commit 9c04f7c155fb799fa7757b5c8bb52400d0dc2ec5
Author: Ulrich Drepper <drepper@redhat.com>
Date:   Fri Oct 30 09:35:20 2009 -0700

    Fix aliasing problem in tst-sem11.

diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index f61cb5c..52176fc 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,5 +1,7 @@
 2009-10-30  Ulrich Drepper  <drepper@redhat.com>
 
+	* tst-sem11.c (main): Rewrite to avoid aliasing problems.
+
 	[BZ #3270]
 	* allocatestack.c (__nptl_setxid): Perform the operation in multiple
 	steps to avoid races with creation and terminations.
diff --git a/nptl/tst-sem11.c b/nptl/tst-sem11.c
index 6633ddd..5248eba 100644
--- a/nptl/tst-sem11.c
+++ b/nptl/tst-sem11.c
@@ -23,23 +23,25 @@ main (void)
 {
   int tries = 5;
   pthread_t th;
-  sem_t s;
+  union
+  {
+    sem_t s;
+    struct new_sem ns;
+  } u;
  again:
-  if (sem_init (&s, 0, 0) != 0)
+  if (sem_init (&u.s, 0, 0) != 0)
     {
       puts ("sem_init failed");
       return 1;
     }
 
-  struct new_sem *is = (struct new_sem *) &s;
-
-  if (is->nwaiters != 0)
+  if (u.ns.nwaiters != 0)
     {
       puts ("nwaiters not initialized");
       return 1;
     }
 
-  if (pthread_create (&th, NULL, tf, &s) != 0)
+  if (pthread_create (&th, NULL, tf, &u.s) != 0)
     {
       puts ("pthread_create failed");
       return 1;
@@ -62,11 +64,11 @@ main (void)
   if (r != PTHREAD_CANCELED && --tries > 0)
     {
       /* Maybe we get the scheduling right the next time.  */
-      sem_destroy (&s);
+      sem_destroy (&u.s);
       goto again;
     }
 
-  if (is->nwaiters != 0)
+  if (u.ns.nwaiters != 0)
     {
       puts ("nwaiters not reset");
       return 1;

-----------------------------------------------------------------------

Summary of changes:
 nptl/ChangeLog   |    2 ++
 nptl/tst-sem11.c |   18 ++++++++++--------
 2 files changed, 12 insertions(+), 8 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]