[Cmake-commits] CMake branch, master, updated. v2.8.2-28-gc3389d4

KWSys Robot kwrobot at kitware.com
Fri Jul 2 14:00:10 EDT 2010


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 "CMake".

The branch, master has been updated
       via  c3389d4ce2a8d3ee0ec1d4824a64347ded5832a0 (commit)
      from  9f3524f4696f394e04077aed93b482ed72cda4ca (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://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c3389d4ce2a8d3ee0ec1d4824a64347ded5832a0
commit c3389d4ce2a8d3ee0ec1d4824a64347ded5832a0
Author: Brad King <brad.king at kitware.com>
Date:   Fri Jul 2 13:57:19 2010 -0400

    KWSys: Avoid Clang optimizer bug in testProcess-[45]
    
    Clang's optimizer, as of clang version 2.8 (trunk 107463), produces the
    undefined instruction 'ud2' for the code "*(int*)0=0" on OS X x86_64.
    It causes our crash tests to fail because the child process exits with
    an invalid instruction instead of a segmentation fault.  Work around the
    bug by using "*(int*)1=0" in this case.

diff --git a/Source/kwsys/testProcess.c b/Source/kwsys/testProcess.c
index 0060c4d..6044917 100644
--- a/Source/kwsys/testProcess.c
+++ b/Source/kwsys/testProcess.c
@@ -94,7 +94,12 @@ int test4(int argc, const char* argv[])
   fprintf(stderr, "Output before crash on stderr from crash test.\n");  
   fflush(stdout);
   fflush(stderr);
+#if defined(__APPLE__) && defined(__x86_64__) && defined(__OPTIMIZE__) \
+ && defined(__clang__)
+  *(int*)1 = 0; /* Clang's optimizer produces bad code for 0-ptr.  */
+#else
   *(int*)0 = 0;
+#endif
   fprintf(stdout, "Output after crash on stdout from crash test.\n");
   fprintf(stderr, "Output after crash on stderr from crash test.\n");
   return 0;

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

Summary of changes:
 Source/kwsys/testProcess.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list