<html>
    <head>
      <base href="https://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 --- - Segfault when compiling with -O2"
   href="https://llvm.org/bugs/show_bug.cgi?id=27233">27233</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Segfault when compiling with -O2
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>Interprocedural Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>rtrieu@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>$ cat test.c
static void* vptr[1];

void run(int *ptr) {

  if (!ptr) {
    vptr[0] = &&point;
    return;
  }

  while (1) {
    point:
    continue;
  }
}

void init() {
  run(0); 
}
$ clang -cc1 -emit-obj -O2 test.c
#0 0x0000000001967118 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/bin/clang-3.5+0x1967118)
#1 0x00000000019656b6 llvm::sys::RunSignalHandlers()
(/usr/local/bin/clang-3.5+0x19656b6)
#2 0x000000000196782e SignalHandler(int) (/usr/local/bin/clang-3.5+0x196782e)
#3 0x00007f35c934d340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x000000000075899e llvm::DataLayout::getTypeSizeInBits(llvm::Type*) const
(/usr/local/bin/clang-3.5+0x75899e)
#5 0x00000000011e130f llvm::MemoryLocation::get(llvm::StoreInst const*)
(/usr/local/bin/clang-3.5+0x11e130f)
#6 0x00000000015fcb93 checkFunctionMemoryAccess(llvm::Function&,
llvm::AAResults&, llvm::SmallSetVector<llvm::Function*, 8u> const&)
(/usr/local/bin/clang-3.5+0x15fcb93)
#7 0x00000000015fc205 (anonymous
namespace)::PostOrderFunctionAttrsLegacyPass::runOnSCC(llvm::CallGraphSCC&)
(/usr/local/bin/clang-3.5+0x15fc205)
#8 0x00000000022ee69b (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/bin/clang-3.5+0x22ee69b)
#9 0x00000000015750f5 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/bin/clang-3.5+0x15750f5)
#10 0x0000000001ab9b63 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/bin/clang-3.5+0x1ab9b63)
#11 0x00000000021c22bb
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/bin/clang-3.5+0x21c22bb)
#12 0x000000000256eb76 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/bin/clang-3.5+0x256eb76)
#13 0x0000000001e7c235 clang::FrontendAction::Execute()
(/usr/local/bin/clang-3.5+0x1e7c235)
#14 0x0000000001e470d1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/bin/clang-3.5+0x1e470d1)
#15 0x0000000001f11e4b
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/bin/clang-3.5+0x1f11e4b)
#16 0x0000000000749d3c cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/bin/clang-3.5+0x749d3c)
#17 0x00000000007487e6 main (/usr/local/bin/clang-3.5+0x7487e6)
#18 0x00007f35c8864ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#19 0x0000000000745722 _start (/usr/local/bin/clang-3.5+0x745722)
Stack dump:
0.    Program arguments: clang -cc1 -emit-obj -O2 test.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'test.c'.
Segmentation fault (core dumped)

This first appears at revision 265273.</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>