When debug flag is set, the LLVM is still being built with -DNDEBUG gcc option, which disables the internal LLVM assertions and debug reporting. The prevents the internal LLVM debugging mechanisms from being used. The llvm-config output is also incorrect. Reproducible: Always Steps to Reproduce: 1. USE="debug" emerge sys-devel/llvm. 2. llvm-config --build-mode 3. llvm-config --cxxflags Actual Results: LLVM build mode is reported correctly as "Debug". CXX flags contain "-DNDEBUG" option. Expected Results: -DNDEBUG should not be passed to gcc when building LLVM with "debug" flag. `llvm-config --cxxflags` output should not contain -DNDEBUG option. See /usr/include/llvm/Support/Debug.h. It contains DEBUG_WITH_TYPE macro and other definitions expected the NDEBUG to be unset. NDEBUG is also shouldn't be set for LLVM "-debug" command line argument to work, which can be really helpful when developing with LLVM (e.g. for LLVM front-end development).
Thanks for the report! I have updated the ebuild to use Debug+Asserts+Checks build mode for debug (without the additional flags, -DNDEBUG creeps in). llvm-2.9-r1 should be fine, don't hesitate to reopen this bug if debug still does not work well for you