Compiling clang with llvm-gcc

Hello,

I'm compiling clang with llvm-gcc-4.2 on Snow Leopard (i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5646) (LLVM build 2118)).
clang and llvm are compiled as a 64 bit binaries (x86_64).

When building a debug version, it works well, but when I build without assert and optimized, clang is badly broken. It often crashes and this is the 'make test' result:

--- Running clang tests for x86_64-apple-darwin10.0.0 ---
[..]
   Expected Passes : 1496
   Expected Failures : 15
   Unexpected Failures: 118

Unexpected failures append in many test sections (Analyze, Codegen, Frontend, Preprocess, Sema, etc…).

Is it a known issue ? Is there any chance it works better if I compile llvm-gcc myself using a newer codebase ?

Thanks

-- Jean-Daniel

This is a known issue with the version of llvm-gcc in Snow Leopard. It was fixed in llvm trunk with <http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090803/083744.html>

You have a few options

  1. Compile llvm/clang as 32-bit binaries by specifying --target/–host/–build as i686-apple-darwin10
  2. Disable optimization for clang, or at least PPMacroExpansion.cpp
  3. As you note, use the LLVM 2.6 release candidate or trunk to build llvm-gcc, and then use that to build llvm/clang

Shantonu