Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to build with LLVM 8 due to non-const lvalue reference to type 'llvm::APSInt' #2513

Open
aktau opened this issue Sep 11, 2019 · 0 comments

Comments

@aktau
Copy link

aktau commented Sep 11, 2019

$ git describe
v0.10.0-94-gd147588e

Should it matter, I'm running Linux kernel 4.19.37.

Build command:

$ ( rm -rf build ; mkdir build && cd build && export PATH=/usr/bin:/bin CC=clang-8 CXX=clang++-8 && cmake .. -GNinja -DCMAKE_INSTALL_PREFIX=$HOME/opt && env -u LUA_PATH ninja && ninja install )

Most files seem to build. Error:

FAILED: src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/b_frontend_action.cc.o 
/usr/bin/clang++-8   -I/usr/lib/llvm-8/include/../tools/clang/include -I../src -Isrc -Isrc/cc -I../src/cc -Isrc/cc/frontends/b -I../src/cc/frontends/b -I../src/cc/frontends/clang -I/usr/lib/llvm-8/include -I../src/cc/libbpf/include -I../src/cc/libbpf/include/uapi -Wall  -isystem /usr/lib/llvm-8/include -fno-rtti -fPIC -DBCC_PROG_TAG_DIR='"/var/tmp/bcc"' -Wno-unused-result -DLLVM_MAJOR_VERSION=8 -DKERNEL_MODULES_DIR='"/lib/modules"' -O3 -DNDEBUG   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=gnu++11 -MD -MT src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/b_frontend_action.cc.o -MF src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/b_frontend_action.cc.o.d -o src/cc/frontends/clang/CMakeFiles/clang_frontend.dir/b_frontend_action.cc.o -c ../src/cc/frontends/clang/b_frontend_action.cc
../src/cc/frontends/clang/b_frontend_action.cc:1107:40: error: non-const lvalue reference to type 'llvm::APSInt' cannot bind to a value of unrelated type 'Expr::EvalResult'
    if (I->getInit(idx)->EvaluateAsInt(res, C)) {
                                       ^~~
/usr/lib/llvm-8/include/clang/AST/Expr.h:602:36: note: passing argument to parameter 'Result' here
  bool EvaluateAsInt(llvm::APSInt &Result, const ASTContext &Ctx,


I could find one similar bug in another project: rpav/c2ffi#59.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant