<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 segfaults when cross compiling arch/arm/mm/context.c for ARM"
   href="http://llvm.org/bugs/show_bug.cgi?id=15676">15676</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang segfaults when cross compiling arch/arm/mm/context.c for ARM
          </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>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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>behanw@converseincode.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>Created <span class=""><a href="attachment.cgi?id=10289" name="attach_10289" title="Code, backtrace, etc">attachment 10289</a> <a href="attachment.cgi?id=10289&action=edit" title="Code, backtrace, etc">[details]</a></span>
Code, backtrace, etc

When cross compiling the Linux kernel for ARM, clang segfaults when compiling
arch/arm/mm/context.c

Code to reproduce in attachment.

/home/behanw/src/kernel/llvmlinux/toolchain/clang/install/bin/clang
-gcc-toolchain
/home/behanw/src/kernel/llvmlinux/arch/arm/toolchain/codesourcery/arm-2011.03/bin
-target arm-linux-gnueabi -include ./include/kconfig.h -D __KERNEL__ -D
__LINUX_ARM_ARCH__=7 -I ./include -O2 -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -Werror-implicit-function-declaration -Wno-format-security
-Wno-asm-operand-widths -Wno-unused-variable -Wno-tautological-compare
-Wdeclaration-after-statement -Wno-pointer-sign -fno-dwarf2-cfi-asm
-fno-dwarf-directory-asm -fdebug-compilation-dir -fwrapv -mstackrealign
-fno-builtin -fobjc-runtime=gcc -fno-common -fdiagnostics-show-option
-fcolor-diagnostics -c -o context.o context-parsed.c -static
clang-3.3: warning: argument unused during compilation:
'-fdebug-compilation-dir -fwrapv' [-Wunused-command-line-argument]
0  clang-3.3       0x0000000001150712 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1  clang-3.3       0x0000000001150399
2  libpthread.so.0 0x00002aaaaaee3cb0
3  clang-3.3       0x0000000000b2bcea
llvm::ARMInstPrinter::getRegisterName(unsigned int) + 10
4  clang-3.3       0x0000000000b2bd50
llvm::ARMInstPrinter::printRegName(llvm::raw_ostream&, unsigned int) const + 80
5  clang-3.3       0x0000000000b2f58c
llvm::ARMInstPrinter::printRegisterList(llvm::MCInst const*, unsigned int,
llvm::raw_ostream&) + 124
6  clang-3.3       0x0000000000b35e76
llvm::ARMInstPrinter::printInstruction(llvm::MCInst const*, llvm::raw_ostream&)
+ 7670
7  clang-3.3       0x0000000000b37501
llvm::ARMInstPrinter::printInst(llvm::MCInst const*, llvm::raw_ostream&,
llvm::StringRef) + 369
8  clang-3.3       0x00000000010aa89f
9  clang-3.3       0x00000000006ed187
10 clang-3.3       0x0000000000998a15 llvm::AsmPrinter::EmitFunctionBody() +
293
11 clang-3.3       0x00000000006e6f2f
12 clang-3.3       0x0000000001073bdf
llvm::FPPassManager::runOnFunction(llvm::Function&) + 607
13 clang-3.3       0x0000000001073c1b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
14 clang-3.3       0x00000000010737af
llvm::MPPassManager::runOnModule(llvm::Module&) + 575
15 clang-3.3       0x00000000010738fc llvm::PassManagerImpl::run(llvm::Module&)
+ 188
16 clang-3.3       0x00000000011729d4
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 3604
17 clang-3.3       0x00000000011700e2
18 clang-3.3       0x00000000013f9d2a clang::ParseAST(clang::Sema&, bool, bool)
+ 538
19 clang-3.3       0x0000000001349969 clang::FrontendAction::Execute() + 185
20 clang-3.3       0x000000000132bdf5
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 293
21 clang-3.3       0x000000000115309a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1514
22 clang-3.3       0x00000000006d4e78 cc1_main(char const**, char const**, char
const*, void*) + 920
23 clang-3.3       0x00000000006c42c5 main + 8133
24 libc.so.6       0x00002aaaab92776d __libc_start_main + 237
25 clang-3.3       0x00000000006d2be5
Stack dump:
0.    Program arguments:
/home/behanw/src/kernel/llvmlinux/toolchain/clang/install/bin/clang-3.3 -cc1
-triple armv4t--linux-gnueabi -S -disable-free -disable-llvm-verifier
-main-file-name context-parsed.c -static-define -mrelocation-model static
-mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-abi aapcs-linux
-target-cpu arm7tdmi -mfloat-abi soft -target-feature +soft-float-abi
-coverage-file
/home/behanw/src/kernel/llvmlinux/targets/vexpress/tmp/context-parsed-60H0nV.s
-resource-dir
/home/behanw/src/kernel/llvmlinux/toolchain/clang/install/bin/../lib/clang/3.3
-include ./include/kconfig.h -D __KERNEL__ -D __LINUX_ARM_ARCH__=7 -I ./include
-internal-isystem /usr/local/include -internal-isystem
/home/behanw/src/kernel/llvmlinux/toolchain/clang/install/bin/../lib/clang/3.3/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
-Werror-implicit-function-declaration -Wno-format-security
-Wno-asm-operand-widths -Wno-unused-variable -Wno-tautological-compare
-Wdeclaration-after-statement -Wno-pointer-sign -fno-dwarf2-cfi-asm
-fno-dwarf-directory-asm -fdebug-compilation-dir
/home/behanw/src/kernel/llvmlinux/test/unit/ARM64bit -ferror-limit 19
-fmessage-length 0 -backend-option -force-align-stack -mstackrealign
-fno-builtin -fno-signed-char -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fno-common -fdiagnostics-show-option
-fcolor-diagnostics -backend-option -vectorize-loops -o
/home/behanw/src/kernel/llvmlinux/targets/vexpress/tmp/context-parsed-60H0nV.s
-x c context-parsed.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'context-parsed.c'.
4.    Running pass 'ARM Assembly / Object Emitter' on function
'@check_and_switch_context'
clang-3.3: error: unable to execute command: Segmentation
fault (core dumped)
clang-3.3: error: clang frontend command failed due to signal
(use -v to see invocation)
clang version 3.3 
Target: arm--linux-gnueabi
Thread model: posix
clang-3.3: note: diagnostic msg: PLEASE submit a bug report to 
and include the crash backtrace, preprocessed source, and associated run
script.
clang-3.3: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.3: note: diagnostic msg:
/home/behanw/src/kernel/llvmlinux/targets/vexpress/tmp/context-parsed-GdtCr3.c
clang-3.3: note: diagnostic msg:
/home/behanw/src/kernel/llvmlinux/targets/vexpress/tmp/context-parsed-GdtCr3.sh
clang-3.3: note: diagnostic msg: 

********************
make: *** [testcase] Error 254</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>