<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 --- - clang crash while trying to print-before-all: Assertion failed: ((*I)->getFunction() && "Expecting non-null Function")"
   href="http://llvm.org/bugs/show_bug.cgi?id=20040">20040</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crash while trying to print-before-all: Assertion failed: ((*I)->getFunction() && "Expecting non-null Function")
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>spatel+llvm@rotateright.com
          </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>Clang built from r210980 crashes when I try to print debug IR for any C or IR
file. I'm running on OS X 10.9.3:

$ cat test.ll
define i32 @main() #0 {
entry:
  ret i32 0
}

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

$ ./clang -mllvm -print-before-all test.ll

...

***Assertion failed: ((*I)->getFunction() && "Expecting non-null Function"),
function runOnSCC, file ~/llvm/lib/Analysis/IPA/CallGraphSCCPass.cpp, line 606.
0  clang-3.5                0x00000001046115de
llvm::sys::PrintStackTrace(__sFILE*) + 46
1  clang-3.5                0x00000001046118eb
PrintStackTraceSignalHandler(void*) + 27
2  clang-3.5                0x0000000104611c7c SignalHandler(int) + 412
3  libsystem_platform.dylib 0x00007fff8fc555aa _sigtramp + 26
4  libsystem_platform.dylib 0x0000000000002800 _sigtramp + 1882903152
5  clang-3.5                0x000000010461191b raise + 27
6  clang-3.5                0x00000001046119d2 abort + 18
7  clang-3.5                0x00000001046119b1 __assert_rtn + 129
8  clang-3.5                0x00000001040b2a1a (anonymous
namespace)::PrintCallGraphPass::runOnSCC(llvm::CallGraphSCC&) + 266
9  clang-3.5                0x00000001040b3ca8 (anonymous
namespace)::CGPassManager::RunPassOnSCC(llvm::Pass*, llvm::CallGraphSCC&,
llvm::CallGraph&, bool&, bool&) + 264
10 clang-3.5                0x00000001040b372e (anonymous
namespace)::CGPassManager::RunAllPassesOnSCC(llvm::CallGraphSCC&,
llvm::CallGraph&, bool&) + 958
11 clang-3.5                0x00000001040b2eac (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&) + 476
12 clang-3.5                0x0000000104041f14 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&) + 1412
13 clang-3.5                0x00000001040417be
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 302
14 clang-3.5                0x0000000104042691
llvm::legacy::PassManager::run(llvm::Module&) + 33
15 clang-3.5                0x00000001050bfa2d (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
llvm::raw_ostream*) + 1517
16 clang-3.5                0x00000001050bf242
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 114
17 clang-3.5                0x00000001052a4710
clang::CodeGenAction::ExecuteAction() + 3280
18 clang-3.5                0x00000001049f2618 clang::FrontendAction::Execute()
+ 120
19 clang-3.5                0x000000010499099e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 990
20 clang-3.5                0x0000000104a4ef70
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3200
21 clang-3.5                0x0000000103a8d300 cc1_main(char const**, char
const**, char const*, void*) + 2368
22 clang-3.5                0x0000000103a8142a main + 858
23 libdyld.dylib            0x00007fff8fcc05fd start + 1
Stack dump:
0.    Program arguments: /Users/sanjay/spatelllvm/cmakebuild/bin/clang-3.5 -cc1
-triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free
-main-file-name o2.ll -mrelocation-model pic -pic-level 2 -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu core2 -resource-dir
/Users/sanjay/spatelllvm/cmakebuild/bin/../lib/clang/3.5.0
-fdebug-compilation-dir /Users/sanjay/spatelllvm/cmakebuild/bin -ferror-limit
19 -fmessage-length 147 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature
-fdiagnostics-show-option -fcolor-diagnostics -mllvm -print-before-all -o
/var/folders/_j/wtthkgw90j70snphj196dkgm0000gp/T/o2-9683f3.o -x ir o2.ll 
1.    Per-module optimization passes
2.    Running pass 'CallGraph Pass Manager' on module 'o2.ll'.
clang-3.5: error: unable to execute command: Illegal instruction: 4
clang-3.5: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.5.0 (210980)
Target: x86_64-apple-darwin13.2.0
Thread model: posix
clang-3.5: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.5: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.</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>