New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 694679 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Mar 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 2
Type: Bug

Blocking:
issue 537368



Sign in to add a comment

LLVM: Build errors when using clang/llvm built with USE="debug"

Project Member Reported by manojgupta@chromium.org, Feb 21 2017

Issue description


I see a lot of errors when building packages for chromeos for veyron_jaq board regarding llvm.objectsize builtin. The error seems to indicate mismatch between objectSize intrinsic constrains in Intrinsics.td and the actual IntrinisicInst generated by clang.

Note that the reason I see these errors is I am building llvm and clang with USE="debug" flag.

To build llvm and clang with USE="debug" :
sudo emerge -C llvm clang # Must remove old llvm and clang first
USE="debug" sudo emerge llvm clang


which-2.20-r1: clang-4.0: /var/tmp/portage/sys-devel/llvm-4.0_pre285905-r3/work/llvm-4.0_pre285905/lib/IR/Instructions.cpp:263: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"' failed.
which-2.20-r1: #0 0x00007f27d7f1c065 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/bin/../lib64/libLLVM-4.0svn.so+0x826065)
which-2.20-r1: #1 0x00007f27d7f19e66 llvm::sys::RunSignalHandlers() (/usr/bin/../lib64/libLLVM-4.0svn.so+0x823e66)
which-2.20-r1: #2 0x00007f27d7f1a350 (/usr/bin/../lib64/libLLVM-4.0svn.so+0x824350)
which-2.20-r1: #3 0x00007f27d6e5adf0 (/lib64/libc.so.6+0x33df0)
which-2.20-r1: #4 0x00007f27d6e5ad72 gsignal (/lib64/libc.so.6+0x33d72)
which-2.20-r1: #5 0x00007f27d6e5caaa abort (/lib64/libc.so.6+0x35aaa)
which-2.20-r1: #6 0x00007f27d6e53d97 (/lib64/libc.so.6+0x2cd97)
which-2.20-r1: #7 0x00007f27d6e53e42 (/lib64/libc.so.6+0x2ce42)
which-2.20-r1: #8 0x00007f27d7fea4cd llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&) (/usr/bin/../lib64/libLLVM-4.0svn.so+0x8f44cd)
which-2.20-r1: #9 0x0000000000894fa6 (/usr/bin/clang-4.0+0x894fa6)
which-2.20-r1: #10 0x0000000000acb828 clang::CodeGen::CodeGenFunction::emitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*) (/usr/bin/clang-4.0+0xacb828)

Chrome Version: (copy from chrome://version)
OS: (e.g. Win7, OSX 10.9.5, etc...)

What steps will reproduce the problem?
(1)
(2)
(3)

What is the expected result?

What happens instead?

Please use labels and text to provide additional information.


For graphics-related bugs, please copy/paste the contents of the about:gpu
page at the end of this report.

 

Comment 1 by g...@chromium.org, Feb 22 2017

Committed r295805 to hopefully fix this; I tried it on a similar-looking failure found when building perl, and clang no longer crashes on it. Will make a CL to cherrypick that change for ChromeOS after LLVM's bots have had some time to decide if they like my change or not.
Project Member

Comment 2 by bugdroid1@chromium.org, Feb 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/92f025fd9ac5c15a22a4bebbe416816c21c8e23b

commit 92f025fd9ac5c15a22a4bebbe416816c21c8e23b
Author: Manoj Gupta <manojgupta@google.com>
Date: Wed Feb 22 19:25:07 2017

llvm: Pick upstream fix bu gbiv for objectsize intrinsic.

clang was crashing with assert on because of incorrect
pointer type passed to llvm.objectsize.

BUG= chromium:694679 
TEST=No more asserts in which, perl packages.

Change-Id: Idb3024d7a3cef279cb0c6754f0406547ff692a08
Reviewed-on: https://chromium-review.googlesource.com/446119
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Trybot-Ready: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[add] https://crrev.com/92f025fd9ac5c15a22a4bebbe416816c21c8e23b/sys-devel/llvm/files/cherry/cefec9cba5ec1629aac083bad2ad7e10e91dcf05.patch
[rename] https://crrev.com/92f025fd9ac5c15a22a4bebbe416816c21c8e23b/sys-devel/llvm/llvm-4.0_pre285905-r4.ebuild

Comment 3 by g...@chromium.org, Feb 22 2017

Status: Fixed (was: Untriaged)
Thanks!
Status: Assigned (was: Fixed)
gdb still fails to build because of assert in an objectsize related function. 

gdb-7.11.20160511-r1: ^[[0mclang-5.0: /var/tmp/portage/sys-devel/llvm-4.0_pre285905-r5/work/llvm-4.0_pre285905/tools/clang/lib/AST/ExprConstant.cpp:1193: void {anonymous}::LValue::moveInto(clang::APValue&) const: Assertion `!InvalidBase && "APValues can't handle invalid LValue bases"' failed.
gdb-7.11.20160511-r1: #0 0x00007ff6e625d0c5 

clang::Expr::tryEvaluateObjectSize(unsigned long&, clang::ASTContext&, unsigned int) const (/usr/bin/clang-5.0+0x1be19fc)
gdb-7.11.20160511-r1: #17 0x0000000000b03a3e clang::CodeGen::CodeGenFunction::evaluateOrEmitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*) (/usr/bin/clang-5.0+0xb03a3e)
gdb-7.11.20160511-r1: #18 0x00000000009cb991 clang::CodeGen::CodeGenFunction::EmitCallArgs(clang::CodeGen::CallArgList&, llvm::ArrayRef<clang::QualType>, llvm::iterator_range<clang::Stmt::ConstExprIterator>, clang::FunctionDecl const*, unsigned int, clang::CodeGen::CodeGenFunction::EvaluationOrder) (/usr/bin/clang-5.0+0x9cb991)




Failing command line:

gdb-7.11.20160511-r1: 0.        Program arguments: /usr/bin/clang-5.0 -cc1 -triple thumbv7-cros-linux-gnueabi -emit-obj -disable-free -main-file-name arm-tdep.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu cortex-a12 -target-feature -fp-only-sp -target-feature -d16 -target-feature +vfp3 -target-feature -fp16 -target-feature -vfp4 -target-feature -fp-armv8 -target-feature +neon -target-feature -crypto -target-abi aapcs-linux -mfloat-abi hard -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file /build/veyron_jaq/tmp/portage/sys-devel/gdb-7.11.20160511-r1/work/gdb-7.11/gdb/arm-tdep.gcno -resource-dir /usr/bin/../lib64/clang/5.0.0 -D _FORTIFY_SOURCE=2 -I . -I . -I ./common -I ./config -D LOCALEDIR="/usr/share/locale" -D HAVE_CONFIG_H -I ./../include/opcode -I ./../opcodes/.. -I ./../zlib -I ../bfd -I ./../bfd -I ./../include -I ../libdecnumber -I ./../libdecnumber -I ./gnulib/import -I build-gnulib/import -D TUI=1 -isysroot ../../../../../../.. -internal-isystem ../../../../../../../usr/local/include -internal-isystem /usr/bin/../lib64/clang/5.0.0/include -internal-externc-isystem ../../../../../../../include -internal-externc-isystem ../../../../../../../usr/include -O2 -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wpointer-sign -Wmissing-prototypes -Wdeclaration-after-statement -Wold-style-definition -Wformat-nonliteral -fdebug-compilation-dir /build/veyron_jaq/tmp/portage/sys-devel/gdb-7.11.20160511-r1/work/gdb-7.11/gdb -ferror-limit 19 -fmessage-length 0 -stack-protector 2 -fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o arm-tdep.o -x c arm-tdep.c

Comment 6 by g...@chromium.org, Feb 22 2017

Does applying r294800 make these go away?
Summary: LLVM: Build errors when using clang/llvm built with USE="debug" (was: Build errors when using clang/llvm built with USE="debug")
Thanks, that fixes gdb failure. I'll pick that as well.
mtd-utils failed even after including r294800 . 

mtd-utils-1.5.2: clang-5.0: /var/tmp/portage/sys-devel/llvm-4.0_pre285905-r5/work/llvm-4.0_pre285905/tools/clang/lib/CodeGen/CodeGenFunction.h:3464: void clang::CodeGen::CodeGenFunction::setAddrOfLocalVar(const clang::VarDecl*, clang::CodeGen::Address): Assertion `!LocalDeclMap.count(VD) && "Decl already exists in LocalDeclMap!"' failed.
mtd-utils-1.5.2: #0 0x00007fcd11e890c5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/bin/../lib64/libLLVM-5.0svn.so+0x87b0c5)
mtd-utils-1.5.2: #1 0x00007fcd11e86f26 llvm::sys::RunSignalHandlers() (/usr/bin/../lib64/libLLVM-5.0svn.so+0x878f26)
mtd-utils-1.5.2: #2 0x00007fcd11e87410 (/usr/bin/../lib64/libLLVM-5.0svn.so+0x879410)
mtd-utils-1.5.2: #3 0x00007fcd10d72df0 (/lib64/libc.so.6+0x33df0)
mtd-utils-1.5.2: #4 0x00007fcd10d72d72 gsignal (/lib64/libc.so.6+0x33d72)
mtd-utils-1.5.2: #5 0x00007fcd10d74aaa abort (/lib64/libc.so.6+0x35aaa)
mtd-utils-1.5.2: #6 0x00007fcd10d6bd97 (/lib64/libc.so.6+0x2cd97)
mtd-utils-1.5.2: #7 0x00007fcd10d6be42 (/lib64/libc.so.6+0x2ce42)
mtd-utils-1.5.2: #8 0x00000000005e57c0 _init (/usr/bin/clang-5.0+0x5e57c0)
mtd-utils-1.5.2: #9 0x00000000008ae32b (/usr/bin/clang-5.0+0x8ae32b)
mtd-utils-1.5.2: #10 0x0000000000a028f1 clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca(clang::VarDecl const&) (/usr/bin/clang-5.0+0xa028f1)
mtd-utils-1.5.2: #11 0x0000000000a034b7 clang::CodeGen::CodeGenFunction::EmitAutoVarDecl(clang::VarDecl const&) (/usr/bin/clang-5.0+0xa034b7)
mtd-utils-1.5.2: #12 0x0000000000a03a02 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/usr/bin/clang-5.0+0xa03a02)
mtd-utils-1.5.2: #13 0x0000000000889917 clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/usr/bin/clang-5.0+0x889917)
mtd-utils-1.5.2: #14 0x0000000000898842 clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*) (/usr/bin/clang-5.0+0x898842)
mtd-utils-1.5.2: #15 0x0000000000893530 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) (/usr/bin/clang-5.0+0x893530)
mtd-utils-1.5.2: #16 0x000000000089470f clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/bin/clang-5.0+0x89470f)
mtd-utils-1.5.2: #17 0x0000000000894a17 clang::CodeGen::CodeGenFunction::EmitCompoundStmt(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/bin/clang-5.0+0x894a17)
mtd-utils-1.5.2: #18 0x000000000060b949 _init (/usr/bin/clang-5.0+0x60b949)
mtd-utils-1.5.2: #19 0x0000000000a598e0 (/usr/bin/clang-5.0+0xa598e0)
mtd-utils-1.5.2: #20 0x0000000000a5a67a (/usr/bin/clang-5.0+0xa5a67a)
mtd-utils-1.5.2: #21 0x0000000000a59b92 (/usr/bin/clang-5.0+0xa59b92)
mtd-utils-1.5.2: #22 0x0000000000a5a67a (/usr/bin/clang-5.0+0xa5a67a)
mtd-utils-1.5.2: #23 0x0000000000a5a6fc (/usr/bin/clang-5.0+0xa5a6fc)
mtd-utils-1.5.2: #24 0x0000000000a5a787 (/usr/bin/clang-5.0+0xa5a787)
mtd-utils-1.5.2: #25 0x0000000000a59495 (/usr/bin/clang-5.0+0xa59495)
mtd-utils-1.5.2: #26 0x0000000000a5a67a (/usr/bin/clang-5.0+0xa5a67a)
mtd-utils-1.5.2: #27 0x000000000060cf47 _init (/usr/bin/clang-5.0+0x60cf47)
mtd-utils-1.5.2: #28 0x0000000000a5a382 (/usr/bin/clang-5.0+0xa5a382)
mtd-utils-1.5.2: #29 0x0000000000a5d507 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/usr/bin/clang-5.0+0xa5d507)
mtd-utils-1.5.2: #30 0x0000000000b03464 clang::CodeGen::CodeGenFunction::emitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*) (/usr/bin/clang-5.0+0xb03464)
mtd-utils-1.5.2: #31 0x0000000000b03a71 clang::CodeGen::CodeGenFunction::evaluateOrEmitBuiltinObjectSize(clang::Expr const*, unsigned int, llvm::IntegerType*) (/usr/bin/clang-5.0+0xb03a71)


mtd-utils-1.5.2: 0.     Program arguments: /usr/bin/clang-5.0 -cc1 -triple thumbv7-cros-linux-gnueabi -emit-obj -disable-free -main-file-name jffs2reader.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu cortex-a12 -target-feature -fp-only-sp -target-feature -d16 -target-feature +vfp3 -target-feature -fp16 -target-feature -vfp4 -target-feature -fp-armv8 -target-feature +neon -target-feature -crypto -target-abi aapcs-linux -mfloat-abi hard -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -ffunction-sections -fdata-sections -coverage-notes-file /build/veyron_jaq/tmp/portage/sys-fs/mtd-utils-1.5.2/work/mtd-utils-1.5.2/armv7a-cros-linux-gnueabi/jffs2reader.gcno -resource-dir /usr/bin/../lib64/clang/5.0.0 -D _FORTIFY_SOURCE=2 -D _GNU_SOURCE -I ./include -I armv7a-cros-linux-gnueabi/include -I ./ubi-utils/include -D WITHOUT_XATTR -D _FILE_OFFSET_BITS=64 -isysroot ../../../../../.. -internal-isystem ../../../../../../usr/local/include -internal-isystem /usr/bin/../lib64/clang/5.0.0/include -internal-externc-isystem ../../../../../../include -internal-externc-isystem ../../../../../../usr/include -O2 -Wall -Wextra -Wwrite-strings -Wno-sign-compare -fconst-strings -fdebug-compilation-dir /build/veyron_jaq/tmp/portage/sys-fs/mtd-utils-1.5.2/work/mtd-utils-1.5.2 -ferror-limit 19 -fmessage-length 0 -stack-protector 2 -fallow-half-arguments-and-returns -fno-signed-char -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o armv7a-cros-linux-gnueabi/jffs2reader.o -x c jffs2reader.c


build_llvm_veyron_jaq.log
28.7 MB Download
To reproduce mtd-utils fail, apply the following patch to sys-devel/llvm 

and do USE="llvm-next" sudo  emerge llvm clang
llvm.patch
49.9 KB Download

Comment 11 by g...@chromium.org, Feb 23 2017

Statement expressions make me so happy.

Reduced test-case: void foo(void *const __attribute__((pass_object_size(0)))); void bar(char *c) { foo(c + ({ int a = 0; a; })); }

For a reason I haven't yet looked into, evaluating a statement expression won't give us a new scope. Given that it seems to be common to use macros to stamp out complicated pointer+offset expressions, we probably shouldn't be re-emitting it anyway, even if we do already check that it has no side-effects.

Will fix soon.

Comment 12 by g...@chromium.org, Feb 23 2017

r295935 seems to fix the mtd issue for me.
Project Member

Comment 13 by bugdroid1@chromium.org, Feb 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/1c00ef346cf9eeeaba2fb7a6f6b15f00b944cd82

commit 1c00ef346cf9eeeaba2fb7a6f6b15f00b944cd82
Author: Manoj Gupta <manojgupta@google.com>
Date: Fri Feb 24 18:22:07 2017

LLVM: Pick 3 upstream fixes.

Fixes errors in handling objectsize builtin in clang
and fix compilation crash in sys-libs/pam.
Apply objectSize fixes only to llvm-next.

BUG= chromium:690639 ,  chromium:694679 
TEST=Errors not seen when building for veyron_jaq, cbuildbot testing
for falco, elm and veyron_jaq.

Change-Id: If84e2e9bf829fd6839ea97ca82b486ae40f8671a
Reviewed-on: https://chromium-review.googlesource.com/446527
Commit-Queue: Manoj Gupta <manojgupta@chromium.org>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Trybot-Ready: Manoj Gupta <manojgupta@chromium.org>
Reviewed-by: Yunlian Jiang <yunlian@chromium.org>

[rename] https://crrev.com/1c00ef346cf9eeeaba2fb7a6f6b15f00b944cd82/sys-devel/llvm/llvm-4.0_pre285905-r5.ebuild
[add] https://crrev.com/1c00ef346cf9eeeaba2fb7a6f6b15f00b944cd82/sys-devel/llvm/files/cherry/93418eeb1d886747332ff404f0e2651e8d77879a.patch
[add] https://crrev.com/1c00ef346cf9eeeaba2fb7a6f6b15f00b944cd82/sys-devel/llvm/files/cherry/fbe18a269deb1a11c16eb2d2419b3c9ef9be8d3b.patch
[add] https://crrev.com/1c00ef346cf9eeeaba2fb7a6f6b15f00b944cd82/sys-devel/llvm/files/cherry/e604e8210fa49cfe23fb262e228d40734eaed141.patch

Blocking: 537368
Project Member

Comment 15 by bugdroid1@chromium.org, Mar 2 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/83cd659cbfaa5b3d2a7862f43c469e02b979e76a

commit 83cd659cbfaa5b3d2a7862f43c469e02b979e76a
Author: George Burgess IV <gbiv@google.com>
Date: Thu Mar 02 02:42:19 2017

LLVM: Cherrypick objectsize fixes to our current compiler

These were already picked for llvm-next; we just had to tweak one of
them a bit because it had some added code for clang's alloc_size
attribute. Please see files/objectsize-evalmodes.patch for details.

BUG= chromium:694679 
TEST=cbuildbot for falco, elm, veyron_jaq; I'm told these patches fixed
all the errors for llvm-next; clang's regression tests all pass locally.

Change-Id: I76cdb2b64773313e0d9504aba2ff8e4cd395f7be
Reviewed-on: https://chromium-review.googlesource.com/447842
Commit-Ready: George Burgess <gbiv@chromium.org>
Tested-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>

[add] https://crrev.com/83cd659cbfaa5b3d2a7862f43c469e02b979e76a/sys-devel/llvm/files/cherry/objectsize-evalmodes.patch
[rename] https://crrev.com/83cd659cbfaa5b3d2a7862f43c469e02b979e76a/sys-devel/llvm/llvm-4.0_pre285905-r7.ebuild

Status: Fixed (was: Assigned)

Comment 17 by dchan@google.com, May 30 2017

Labels: VerifyIn-60
Labels: VerifyIn-61
Status: Verified (was: Fixed)
Closing. Please reopen it if its not fixed. Thanks!

Sign in to add a comment