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.24-499-g8d71242


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  8d71242eb7a85860bc4f7cef5463ad61e2ea19b2 (commit)
      from  525f803984f278e65dc07ca1156bdeca63755810 (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://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8d71242eb7a85860bc4f7cef5463ad61e2ea19b2

commit 8d71242eb7a85860bc4f7cef5463ad61e2ea19b2
Author: Florian Weimer <fweimer@redhat.com>
Date:   Tue Dec 20 11:01:05 2016 +0100

    Do not require memset elimination in explicit_bzero test
    
    Some targets fail to apply dead store elimination to the
    memset call in setup_ordinary_clear.  Before this commit,
    this causes the test case to fail.  Instead, the test case
    now logs lack of memset elimination as an informational
    message.

diff --git a/ChangeLog b/ChangeLog
index 3e6a39f..8cdcae6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-12-20  Florian Weimer  <fweimer@redhat.com>
+
+	Do not require memset elimination in explicit_bzero test.
+	* string/tst-xbzero-opt.c (prepare_test_buffer): Force inlining.
+	(enum test_expectation): Add NO_EXPECTATIONS.
+	(subtests): NO_EXPECTATIONS for ordinary clear.
+	(check_test_buffer): Handle NO_EXPECTATIONS.
+	* string/Makefile (CFLAGS-tst-xbzero-opt.c): Compile with -O3.
+
 2016-12-20  Joseph Myers  <joseph@codesourcery.com>
 
 	* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
diff --git a/string/Makefile b/string/Makefile
index 9a8b46d..0816277 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -71,6 +71,7 @@ CFLAGS-tst-strlen.c = -fno-builtin
 CFLAGS-stratcliff.c = -fno-builtin
 CFLAGS-test-ffs.c = -fno-builtin
 CFLAGS-tst-inlcall.c = -fno-builtin
+CFLAGS-tst-xbzero-opt.c = -O3
 
 ifeq ($(run-built-tests),yes)
 $(objpfx)tst-svc-cmp.out: tst-svc.expect $(objpfx)tst-svc.out
diff --git a/string/tst-xbzero-opt.c b/string/tst-xbzero-opt.c
index 312857e..3fcaf28 100644
--- a/string/tst-xbzero-opt.c
+++ b/string/tst-xbzero-opt.c
@@ -88,19 +88,19 @@ static const unsigned char test_pattern[16] =
    between preparing it and letting it go out of scope, and we expect
    to find it.  This confirms that the test buffer does get filled in
    and we can find it from the stack buffer.  In the "ordinary_clear"
-   case, we clear it using memset, and we expect to find it.  This
-   confirms that the compiler can optimize out block clears in this
-   context; if it can't, the real test might be succeeding for the
-   wrong reason.  Finally, the "explicit_clear" case uses
-   explicit_bzero and expects _not_ to find the test buffer, which is
-   the real test.  */
+   case, we clear it using memset.  Depending on the target, the
+   compiler may not be able to apply dead store elimination to the
+   memset call, so the test does not fail if the memset is not
+   eliminated.  Finally, the "explicit_clear" case uses explicit_bzero
+   and expects _not_ to find the test buffer, which is the real
+   test.  */
 
 static ucontext_t uc_main, uc_co;
 
 /* Always check the test buffer immediately after filling it; this
    makes externally visible side effects depend on the buffer existing
    and having been filled in.  */
-static void
+static inline __attribute__  ((always_inline)) void
 prepare_test_buffer (unsigned char *buf)
 {
   for (unsigned int i = 0; i < PATTERN_REPS; i++)
@@ -133,7 +133,10 @@ setup_explicit_clear (void)
   explicit_bzero (buf, TEST_BUFFER_SIZE);
 }
 
-enum test_expectation { EXPECT_NONE, EXPECT_SOME, EXPECT_ALL };
+enum test_expectation
+  {
+    EXPECT_NONE, EXPECT_SOME, EXPECT_ALL, NO_EXPECTATIONS
+  };
 struct subtest
 {
   void (*setup_subtest) (void);
@@ -145,7 +148,9 @@ static const struct subtest *cur_subtest;
 static const struct subtest subtests[] =
 {
   { setup_no_clear,       "no clear",       EXPECT_SOME },
-  { setup_ordinary_clear, "ordinary clear", EXPECT_SOME },
+  /* The memset may happen or not, depending on compiler
+     optimizations.  */
+  { setup_ordinary_clear, "ordinary clear", NO_EXPECTATIONS },
   { setup_explicit_clear, "explicit clear", EXPECT_NONE },
   { 0,                    0,                -1          }
 };
@@ -225,6 +230,11 @@ check_test_buffer (enum test_expectation expected,
 	}
       break;
 
+    case NO_EXPECTATIONS:
+      printf ("INFO: %s/%s: found %d patterns%s\n", label, stage, cnt,
+	      cnt == 0 ? " (memset not eliminated)" : "");
+      break;
+
     default:
       printf ("ERROR: %s/%s: invalid value for 'expected' = %d\n",
 	      label, stage, (int)expected);

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

Summary of changes:
 ChangeLog               |    9 +++++++++
 string/Makefile         |    1 +
 string/tst-xbzero-opt.c |   28 +++++++++++++++++++---------
 3 files changed, 29 insertions(+), 9 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]