<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 --- - Crash with va_list using -mcmodel=medium and -fPIC"
   href="http://llvm.org/bugs/show_bug.cgi?id=18652">18652</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash with va_list using -mcmodel=medium and -fPIC
          </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>zev@bewilderbeest.net
          </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>Attempting to compile the following code using -mcmodel=medium and -fPIC on
clang 3.4 (built from release tarball with gcc 4.8.2) yields a crash:

[zev@host: tmp]% cat foo.i
extern char c;
void f(char, __builtin_va_list);
void g(void)
{
 __builtin_va_list v;
 f(c, v);
}
[zev@host: tmp]% /var/tmp/unsup-test/llvm-3.4/bin/clang -c -mcmodel=medium
-fPIC -o foo.o foo.i
Unimplemented
UNREACHABLE executed at
/var/tmp/unsup-test/llvm-3.4/src/llvm-3.4/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp:107!
0  clang           0x000000000232e462 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  clang           0x000000000232e084
2  libpthread.so.0 0x000000354fa0f710
3  libc.so.6       0x000000354ee32925 gsignal + 53
4  libc.so.6       0x000000354ee34105 abort + 373
5  clang           0x000000000231b08c
6  clang           0x0000000002160ccc
7  clang           0x000000000217c938
8  clang           0x0000000002195b7a
llvm::MCAssembler::handleFixup(llvm::MCAsmLayout const&, llvm::MCFragment&,
llvm::MCFixup const&) + 106
9  clang           0x0000000002198d63 llvm::MCAssembler::Finish() + 707
10 clang           0x0000000001c65fc3
llvm::AsmPrinter::doFinalization(llvm::Module&) + 1299
11 clang           0x00000000022b9549
llvm::FPPassManager::doFinalization(llvm::Module&) + 153
12 clang           0x00000000022c06e3
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 963
13 clang           0x00000000009a9cfb
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 2283
14 clang           0x00000000009a779c
15 clang           0x0000000000b2186b clang::ParseAST(clang::Sema&, bool, bool)
+ 507
16 clang           0x00000000009a5d4c clang::CodeGenAction::ExecuteAction() +
60
17 clang           0x000000000082de29 clang::FrontendAction::Execute() + 249
18 clang           0x000000000080ce60
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 352
19 clang           0x00000000007f5b61
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1857
20 clang           0x00000000007f0bf8 cc1_main(char const**, char const**, char
const*, void*) + 1208
21 clang           0x00000000007d0180 main + 688
22 libc.so.6       0x000000354ee1ed1d __libc_start_main + 253
23 clang           0x00000000007efa3d
Stack dump:
0.      Program arguments: /var/tmp/unsup-test/llvm-3.4/amd64_rhel6/bin/clang
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name foo.i -mrelocation-model pic -pic-level 2 -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -mcode-model
medium -target-cpu x86-64 -target-linker-version 2.20.51.0.2 -coverage-file
/tmp/foo.o -resource-dir
/var/tmp/unsup-test/llvm-3.4/amd64_rhel6/bin/../lib/clang/3.4
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 106
-mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -o foo.o -x cpp-output foo.i 
1.      <eof> parser at end of file
2.      Code generation
clang: error: unable to execute command: Aborted (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


In addition to the va_list and flags, it also appears dependent on the
extern-ness of the declaration of 'c' -- removing that avoids the crash.</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>