aboutsummaryrefslogtreecommitdiff
path: root/nptl
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-09-03 09:29:01 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-09-03 09:29:01 +0530
commit6c8bbad92726eeb50c9bb4107dad80155062eb0a (patch)
tree668cb7fc9fb6e93914a49660c6ed9733801e619b /nptl
parent18d4371683fbe347bf4fbaef05d18b5a4918887a (diff)
downloadglibc-6c8bbad92726eeb50c9bb4107dad80155062eb0a.zip
glibc-6c8bbad92726eeb50c9bb4107dad80155062eb0a.tar.gz
glibc-6c8bbad92726eeb50c9bb4107dad80155062eb0a.tar.bz2
Mark success return value as volatile to work around rescheduling
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.
Diffstat (limited to 'nptl')
-rw-r--r--nptl/ChangeLog6
-rw-r--r--nptl/tst-cleanup2.c8
2 files changed, 13 insertions, 1 deletions
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index d1efbb4..7511f70 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -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.
diff --git a/nptl/tst-cleanup2.c b/nptl/tst-cleanup2.c
index 5bd1609..65af0f2 100644
--- a/nptl/tst-cleanup2.c
+++ b/nptl/tst-cleanup2.c
@@ -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");