]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Mark success return value as volatile to work around rescheduling
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Tue, 3 Sep 2013 03:59:01 +0000 (09:29 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Tue, 3 Sep 2013 03:59:01 +0000 (09:29 +0530)
Resolves #15921

The test case nptl/tst-cleanup2 fails on s390x and power6 due to
instruction sheduling in gcc.  This was reported in gcc:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58034

but it was concluded that gcc is allowed to assume that the first
argument to sprintf is a character array - NULL not being a valid
character array.

NEWS
nptl/ChangeLog
nptl/tst-cleanup2.c

diff --git a/NEWS b/NEWS
index 17e8eb6637459d6407dc9135973c8bd71dc48864..7ac718f52860f8791d0455cfe198a7f9ab8c728c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ Version 2.19
 * The following bugs are resolved with this release:
 
   14155, 14699, 15522, 15531, 15532, 15736, 15749, 15797, 15867, 15890,
-  15897, 15905, 15909.
+  15897, 15905, 15909, 15921.
 
 * CVE-2013-4237 The readdir_r function could write more than NAME_MAX bytes
   to the d_name member of struct dirent, or omit the terminating NUL
index d1efbb43e5f55f1f12f1846d3d3d6d45261766ad..7511f701ec80deb5ad264c734d24490d7a881ec9 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-03  Siddhesh Poyarekar  <siddhesh@redhat.com>
+
+       [BZ #15921]
+       * tst-cleanup2.c (do_test): New volatile variable RET to
+       return success.
+
 2013-08-30   Ondřej Bílka  <neleai@seznam.cz>
 
        * sysdeps/pthread/pthread.h: Fix typos.
index 5bd16095a6899275c75b567c334ba239e27638ad..65af0f2018bf02f42eec0626deec93d5f6a4d24a 100644 (file)
@@ -34,6 +34,12 @@ static int
 do_test (void)
 {
   char *p = NULL;
+  /* gcc can overwrite the success written value by scheduling instructions
+     around sprintf.  It is allowed to do this since according to C99 the first
+     argument of sprintf is a character array and NULL is not a valid character
+     array.  Mark the return value as volatile so that it gets reloaded on
+     return.  */
+  volatile int ret = 0;
   struct sigaction sa;
 
   sa.sa_handler = sig_handler;
@@ -50,7 +56,7 @@ do_test (void)
   if (setjmp (jmpbuf))
     {
       puts ("Exiting main...");
-      return 0;
+      return ret;
     }
 
   sprintf (p, "This should segv\n");