<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 -### (through ccc-analyzer) mistranslates -march, inserts wrong triple"
   href="http://llvm.org/bugs/show_bug.cgi?id=16484">16484</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang -### (through ccc-analyzer) mistranslates -march, inserts wrong triple
          </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>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>e.bachmakov@gmail.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>When scan-build calls ccc-analyzer calls the clang driver to get cc1-style
cmdargs the following happens:

clang -Wp,-MD,kernel/.bounds.s.d -nostdinc -isystem
/home/e/llvmlinux/toolchain/clang/install/bin/../lib/clang/3.4/include clang
-print-file-name=include
-I/home/e/llvmlinux/targets/vexpress/src/linux/arch/arm/include
-Iarch/arm/include/generated -Iinclude
-I/home/e/llvmlinux/targets/vexpress/src/linux/arch/arm/include/uapi
-Iarch/arm/include/generated/uapi
-I/home/e/llvmlinux/targets/vexpress/src/linux/include/uapi
-Iinclude/generated/uapi -include
/home/e/llvmlinux/targets/vexpress/src/linux/include/linux/kconfig.h
-D__KERNEL__ -Qunused-arguments -target arm-none-linux-gnueabi -mlittle-endian
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -Werror-implicit-function-declaration -Wno-format-security
-no-integrated-as -fno-delete-null-pointer-checks -O2 -fno-builtin
-Wno-asm-operand-widths -Xassembler -mno-warn-deprecated -fno-dwarf2-cfi-asm
-fstack-protector -funwind-tables -D__LINUX_ARM_ARCH__=7 -march=armv7-a
-msoft-float -Wframe-larger-than=1024 -Wno-unused-variable
-Wno-format-invalid-specifier -Wno-tautological-compare -fomit-frame-pointer -g
-fno-inline-functions-called-once -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -fconserve-stack -gcc-toolchain
/home/e/llvmlinux/arch/arm/toolchain/codesourcery/arm-2011.03
-DKBUILD_STR(s)=#s -DKBUILD_BASENAME=KBUILD_STR(bounds)
-DKBUILD_MODNAME=KBUILD_STR(bounds) -fverbose-asm -S -o kernel/bounds.s
kernel/bounds.c

becomes

'/home/e/llvmlinux/toolchain/clang/install/bin/clang-3.4' '-###' ''
'-fsyntax-only' '-x' 'c' '-nostdinc' '-isystem'
'/home/e/llvmlinux/toolchain/clang/install/bin/../lib/clang/3.4/include'
'-I/home/e/llvmlinux/targets/vexpress/src/linux/arch/arm/include'
'-Iarch/arm/include/generated' '-Iinclude'
'-I/home/e/llvmlinux/targets/vexpress/src/linux/arch/arm/include/uapi'
'-Iarch/arm/include/generated/uapi'
'-I/home/e/llvmlinux/targets/vexpress/src/linux/include/uapi'
'-Iinclude/generated/uapi' '-include'
'/home/e/llvmlinux/targets/vexpress/src/linux/include/linux/kconfig.h'
'-D__KERNEL__' '-mlittle-endian' '-Wno-trigraphs' '-Wno-format-security'
'-fno-builtin' '-Wno-asm-operand-widths' '-mno-warn-deprecated'
'-D__LINUX_ARM_ARCH__=7' '-march=armv7-a' '-msoft-float' '-Wno-unused-variable'
'-Wno-format-invalid-specifier' '-Wno-tautological-compare' '-Wno-pointer-sign'
'-DKBUILD_BASENAME=KBUILD_STR(bounds)' '-DKBUILD_MODNAME=KBUILD_STR(bounds)'
'kernel/bounds.c'

(captured during a call to GetCCArgs) gives output

clang version 3.4 
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang-3.4: warning: argument unused during compilation: '-mlittle-endian'
clang-3.4: warning: argument unused during compilation: '-mno-warn-deprecated'
 "/home/e/llvmlinux/toolchain/clang/install/bin/clang-3.4" "-cc1" "-triple"
"x86_64-unknown-linux-gnu" "-fsyntax-only" "-disable-free"
"-disable-llvm-verifier" "-main-file-name" "bounds.c" "-mrelocation-model"
"static" "-mdisable-fp-elim" "-fmath-errno" "-masm-verbose"
"-mconstructor-aliases" "-munwind-tables" "-fuse-init-array"
"-no-implicit-float" "-target-cpu" "armv7-a" "-nostdsysteminc" "-nobuiltininc"
"-resource-dir"
"/home/e/llvmlinux/toolchain/clang/install/bin/../lib/clang/3.4" "-isystem"
"/home/e/llvmlinux/toolchain/clang/install/bin/../lib/clang/3.4/include"
"-include"
"/home/e/llvmlinux/targets/vexpress/src/linux/include/linux/kconfig.h" "-D"
"__KERNEL__" "-D" "__LINUX_ARM_ARCH__=7" "-D"
"KBUILD_BASENAME=KBUILD_STR(bounds)" "-D" "KBUILD_MODNAME=KBUILD_STR(bounds)"
"-I" "/home/e/llvmlinux/targets/vexpress/src/linux/arch/arm/include" "-I"
"arch/arm/include/generated" "-I" "include" "-I"
"/home/e/llvmlinux/targets/vexpress/src/linux/arch/arm/include/uapi" "-I"
"arch/arm/include/generated/uapi" "-I"
"/home/e/llvmlinux/targets/vexpress/src/linux/include/uapi" "-I"
"include/generated/uapi" "-Wno-trigraphs" "-Wno-format-security"
"-Wno-asm-operand-widths" "-Wno-unused-variable"
"-Wno-format-invalid-specifier" "-Wno-tautological-compare" "-Wno-pointer-sign"
"-fdebug-compilation-dir" "/home/e/llvmlinux/targets/vexpress/src/linux"
"-ferror-limit" "19" "-fmessage-length" "239" "-mstackrealign" "-fno-builtin"
"-fobjc-runtime=gcc" "-fobjc-default-synthesize-properties"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-backend-option"
"-vectorize-loops" "-x" "c" "kernel/bounds.c"

Note,
1. "-triple" "x86_64-unknown-linux-gnu" is just plain wrong, I'm compiling for
arm here, see -march
2. "-target-cpu" "armv7-a" is not a thing, it should have been translated to
cortex-a8 (IIRC)

Nr 2 Ends up giving me the error, "error: unknown target CPU 'armv7-a'"

This is for llvm rev 0f2eec65fb9e9e1dee3f672d38d03d047936a62a
and clang rev 9db37cd0aa8fa6ec840bfd9166090be5a39b691a

What else would you like for documentation?</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>