<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 --- - llvm.var.annotation segfault"
   href="http://llvm.org/bugs/show_bug.cgi?id=18794">18794</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm.var.annotation segfault
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>snobl.P@seznam.cz
          </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=12039" name="attach_12039" title="An example of a problematic file">attachment 12039</a> <a href="attachment.cgi?id=12039&action=edit" title="An example of a problematic file">[details]</a></span>
An example of a problematic file

We've added some new pragmas to Clang. They are represented as a call to
llvm.var.annotation function in the IR. However, this sometimes leads to a
segfault in the "Global Variable Optimizer" pass. Weird thing is, that this
doesn't happen if you create the IR file using Clang with -O0 and then run it
through opt manually. After some experiments I'm almost certain the problem is
caused by Global Variable Optimizer's problem with the use of
llvm.var.annotation calls (or more specifically, it's global variable
parameters).
The attached file "getblk.c" is just an example, it won't work unless you have
implemented support for our pragmas.

0  clang           0x0000000002478e92 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  clang           0x0000000002478a79
2  libpthread.so.0 0x00007fd54c0a5bd0
3  clang           0x000000000213745d
4  clang           0x0000000002137413
5  clang           0x00000000021378ee
llvm::GlobalStatus::analyzeGlobal(llvm::Value const*, llvm::GlobalStatus&) +
126
6  clang           0x00000000015a7a2f
7  clang           0x00000000015a8b15
8  clang           0x0000000002407e4f
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 863
9  clang           0x00000000009d7e0a
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 3546
10 clang           0x00000000009d55ff
11 clang           0x0000000000b617c2 clang::ParseAST(clang::Sema&, bool, bool)
+ 514
12 clang           0x00000000009d4501 clang::CodeGenAction::ExecuteAction() +
97
13 clang           0x0000000000842469 clang::FrontendAction::Execute() + 265
14 clang           0x000000000081fd15
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 357
15 clang           0x00000000008067ee
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1886
16 clang           0x0000000000800508 cc1_main(char const**, char const**, char
const*, void*) + 1208
17 clang           0x00000000007eb578 main + 712
18 libc.so.6       0x00007fd54b0a4ea5 __libc_start_main + 245
19 clang           0x00000000007ff39d
Stack dump:
0.    Program arguments: /usr/local/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-llvm -disable-free -main-file-name getblk.c
-mrelocation-model static -fmath-errno -masm-verbose -mconstructor-aliases
-munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version
2.23.2 -momit-leaf-frame-pointer -g -coverage-file /home/pavel/Plocha/Modely v
Codalu a
MPEG2/testsuitedata/compiler/llvm-testsuite/test-suite/IntBenchmarks/mediabench-mpeg2/mpeg2dec/reports-3.4
fixed/getblk.ll -resource-dir /usr/local/bin/../lib/clang/3.4 -internal-isystem
/usr/local/include -internal-isystem /usr/local/bin/../lib/clang/3.4/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fdebug-compilation-dir /home/pavel/Plocha/Modely v Codalu a
MPEG2/testsuitedata/compiler/llvm-testsuite/test-suite/IntBenchmarks/mediabench-mpeg2/mpeg2dec/reports-3.4
fixed -ferror-limit 19 -fmessage-length 186 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o getblk.ll -x c ../getblk.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'Global Variable Optimizer' on module '../getblk.c'.
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: 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: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/getblk-05bee3.c
clang: note: diagnostic msg: /tmp/getblk-05bee3.sh
clang: note: diagnostic msg: 

********************</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>