<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Combining -mllvm -polly and -flto in 3.6+ crashes... intermittently?"
   href="http://llvm.org/bugs/show_bug.cgi?id=22513">22513</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Combining -mllvm -polly and -flto in 3.6+ crashes... intermittently?
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.6
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>geoff@geoff.codes
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13826" name="attach_13826" title="Generated llvm-config.h">attachment 13826</a> <a href="attachment.cgi?id=13826&action=edit" title="Generated llvm-config.h">[details]</a></span>
Generated llvm-config.h

I've been testing the 3.6 release branch, and have run into the following:

Clang (from the 3.6 branch or trunk) will crash, intermittently, when emitting
bitcode when `-mllvm -polly` is in effect.

Specifics:

- Polly (built against isl + imath) has been linked into clang, which has been
built and linked against libcxx and libcxxabi (with the libcxxabi libunwind),
all from the release_36 branch (or trunk), Release build, without asserts.
Darwin, x86_64, running 10.10, built against the 10.7 SDK; also occurs when
built against the native SDK.. Occurs with both -march=core-avx-i (native on my
machine) and -march=core2.
- This only occurs when *both* -emit-llvm-bc and -mllvm -polly are in effect
(no crash when one or the other is omitted).
- It successfully compiles about 25% of the time, at for the test case below,
with the same file and same flags; it does not always fail on the same
function.
- It does not occur in 3.5.1.
- It seems largely (exclusively?) to crop up when building LLVM itself.

I've been able to boil down a reproducible (for me at least, hopefully for you)
case:

clang-3.6 -cc1 -triple x86_64-apple-macosx10.7.0 -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -I/tmp/llvm/lib/Support
-I/tmp/llvm/include -stdlib=libc++ -std=c++11 -x c++ -o
/tmp/build/lib/Support/CMakeFiles/LLVMSupport.dir/FoldingSet.cpp.o
/tmp/llvm/lib/Support/FoldingSet.cpp -O3 -mllvm -polly -emit-llvm-bc

Which usually will emit a trace similar to:

---------------------------------------------------------------------------------------
0  clang                    0x000000010c37aca0
PrintStackTraceSignalHandler(void*) + 64
1  clang                    0x000000010c37b26b SignalHandler(int) + 331
2  libsystem_platform.dylib 0x00007fff91b4ff1a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fb17365d600 _sigtramp + 3786462976
4  clang                    0x000000010bedef16
getFoldedCast(llvm::Instruction::CastOps, llvm::Constant*, llvm::Type*, bool) +
38
5  clang                    0x000000010c0ca5b5
llvm::InstCombiner::visitSelectInst(llvm::SelectInst&) + 10629
6  clang                    0x000000010c03aa8b
llvm::InstCombiner::runOnFunction(llvm::Function&) + 8587
7  clang                    0x000000010bf87986
llvm::FPPassManager::runOnFunction(llvm::Function&) + 550
8  clang                    0x000000010bf87c6b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
9  clang                    0x000000010bf884fb
llvm::legacy::PassManager::run(llvm::Module&) + 907
10 clang                    0x000000010ca49bfc
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
10492
11 clang                    0x000000010cbc09f7
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 519
12 clang                    0x000000010cfedb2f clang::ParseAST(clang::Sema&,
bool, bool) + 607
13 clang                    0x000000010c64a009 clang::FrontendAction::Execute()
+ 73
14 clang                    0x000000010c600163
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 947
15 clang                    0x000000010c694198
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 9192
16 clang                    0x000000010b3dec82 main + 27986
17 clang                    0x000000010b35db04 start + 52
18 clang                    0x0000000000000015 start + 4106888517
Stack dump:
0.    Program arguments: clang-3.6 -cc1 -triple x86_64-apple-macosx10.7.0
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG
-I/tmp/llvm/lib/Support -I/tmp/llvm/include -stdlib=libc++ -std=c++11 -x c++ -o
/tmp/build/lib/Support/CMakeFiles/LLVMSupport.dir/FoldingSet.cpp.o
/tmp/llvm/lib/Support/FoldingSet.cpp -O3 -mllvm -polly -emit-llvm-bc
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'Function Pass Manager' on module
'/tmp/llvm/lib/Support/FoldingSet.cpp'.
4.    Running pass 'Combine redundant instructions' on function
'@_ZNSt3__118uninitialized_copyIPKjPjEET0_T_S5_S4_'
---------------------------------------------------------------------------------------

And to reiterate, all of the following work fine:

clang-3.5 -cc1 -triple x86_64-apple-macosx10.7.0 -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -I/tmp/llvm/lib/Support
-I/tmp/llvm/include -stdlib=libc++ -std=c++11 -x c++ -o
/tmp/build/lib/Support/CMakeFiles/LLVMSupport.dir/FoldingSet.cpp.o
/tmp/llvm/lib/Support/FoldingSet.cpp -O3 -mllvm -polly -emit-llvm-bc

clang-3.6 -cc1 -triple x86_64-apple-macosx10.7.0 -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -I/tmp/llvm/lib/Support
-I/tmp/llvm/include -stdlib=libc++ -std=c++11 -x c++ -o
/tmp/build/lib/Support/CMakeFiles/LLVMSupport.dir/FoldingSet.cpp.o
/tmp/llvm/lib/Support/FoldingSet.cpp -O3 -mllvm -polly

clang-3.6 -cc1 -triple x86_64-apple-macosx10.7.0 -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DNDEBUG -I/tmp/llvm/lib/Support
-I/tmp/llvm/include -stdlib=libc++ -std=c++11 -x c++ -o
/tmp/build/lib/Support/CMakeFiles/LLVMSupport.dir/FoldingSet.cpp.o
/tmp/llvm/lib/Support/FoldingSet.cpp -O3 -emit-llvm-bc

And it successfully compiles about every fourth attempt.

I'll attach my generated DataTypes.h and llvm-config.h; please let me know if
you want anything more. If you'd like me bisect at a certain rev, test a patch,
try something out, add some debug flags, etc., I'm more that happy to help.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>