[LLVMbugs] [Bug 16484] New: clang -### (through ccc-analyzer) mistranslates -march, inserts wrong triple

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 28 08:49:43 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16484

            Bug ID: 16484
           Summary: clang -### (through ccc-analyzer) mistranslates
                    -march, inserts wrong triple
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: e.bachmakov at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130628/638a0b82/attachment.html>


More information about the llvm-bugs mailing list