<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 --- - __builtin_setjmp with jmp_buf in a struct causes `fatal error in backend' or segmentation fault"
   href="http://llvm.org/bugs/show_bug.cgi?id=19330">19330</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>__builtin_setjmp with jmp_buf in a struct causes `fatal error in backend' or segmentation fault
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>nobu@ruby-lang.org
          </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=12337" name="attach_12337" title="minimal code to reproduce the error">attachment 12337</a> <a href="attachment.cgi?id=12337&action=edit" title="minimal code to reproduce the error">[details]</a></span>
minimal code to reproduce the error

Compiling the attached source with `-O', clang aborts with fatal error, linker
error, or segmentation fault.

On MacOS X:

$ clang -v
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

$ clang -arch x86_64 -O -c clang_bug.c 
clang_bug.c:11:29: warning: incompatible pointer types passing 'jmp_buf' (aka
'int [37]') to parameter of type 'void **' [-Wincompatible-pointer-types]
    (void)(__builtin_setjmp(tag.buf) ? 1 : 0);
                            ^~~~~~~
fatal error: error in backend: unsupported relocation of undefined symbol
'LBB0_-1'

$ clang -arch i386 -O -c clang_bug.c 
clang_bug.c:11:29: warning: incompatible pointer types passing 'jmp_buf' (aka
'int [18]') to parameter of type 'void **' [-Wincompatible-pointer-types]
    (void)(__builtin_setjmp(tag.buf) ? 1 : 0);
                            ^~~~~~~
Stack dump:
0.    Program arguments:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-cc1 -triple i386-apple-macosx10.9.0 -emit-obj -disable-free
-disable-llvm-verifier -main-file-name clang_bug.c -mrelocation-model pic
-pic-level 2 -mdisable-fp-elim -masm-verbose -target-cpu yonah
-target-linker-version 236.3 -coverage-file
/Users/nobu/src/ruby/trunk/src/clang_bug.o -resource-dir
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1
-O2 -fdebug-compilation-dir /Users/nobu/src/ruby/trunk/src -ferror-limit 19
-fmessage-length 238 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-fragile-10.9.0 -fencode-extended-block-signature
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o clang_bug.o -x c clang_bug.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'clang_bug.c'.
4.    Running pass 'Machine Common Subexpression Elimination' on function
'@jump'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: i386-apple-darwin13.1.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://developer.apple.com/bugreporter/">http://developer.apple.com/bugreporter/</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:
/var/folders/k_/fqcsxh9x35j1f9q463bj01zw0000gn/T/clang_bug-59499f.c
clang: note: diagnostic msg:
/var/folders/k_/fqcsxh9x35j1f9q463bj01zw0000gn/T/clang_bug-59499f.sh
clang: note: diagnostic msg: 

********************

On x86_64-linux clang 34 and FreeBSD clang 3.3:
test.c:10:27: warning: incompatible pointer types passing 'jmp_buf' (aka
'struct __jmp_buf_tag [1]') to parameter of type 'void **'
[-Wincompatible-pointer-types]
(void)(__builtin_setjmp(tag.buf) ? 1 : 0);
^~~~~~~
1 warning generated.
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../lib64/crt1.o: In function
`_start':
(.text+0x20): undefined reference to `main'
/tmp/test-11ca81.o: In function `jump':
test.c:(.text+0x26): undefined reference to `.LBB0_-1'
clang: error: linker command failed with exit code 1 (use -v to see invocation)</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>