Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Error running trivial plugin on CUDA program #29827

Open Quuxplusone opened 8 years ago

Quuxplusone commented 8 years ago
Bugzilla Link PR30854
Status NEW
Importance P normal
Reported by David Poliakoff (poliakoff1@llnl.gov)
Reported on 2016-10-31 14:28:34 -0700
Last modified on 2016-10-31 14:28:52 -0700
Version unspecified
Hardware PC Linux
CC klimek@google.com, poliakoff1@llnl.gov
Fixed by commit(s)
Attachments SamplePlugin.cpp (4054 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 17519
Minimal RecursiveASTVisitor plugin sample

I've been trying out the CUDA support in Clang, in this case I did a pull on 10-
25. This may need to be crossposted there, let me know if I should be moving
things. I started running into issues with a compiler plugin I had developed
for our applications. I have since found I can get the same bug with a trivial
plugin and application.

The build command is

[path_to_clang]/clang-cuda-beta-2016-10-25/bin/clang++ -x cuda --cuda-
path=[valid cuda path] -fplugin=plugin_raja.so -Xclang -plugin-arg-lambda-
checker -Xclang bobby -O3 -fopenmp -O3 -DNDEBUG -
I/g/g0/dzpolia/src/RAJA/build/tpl/src/googletest/include -
I/g/g0/dzpolia/src/RAJA/build/include/RAJA -
I/g/g0/dzpolia/src/RAJA/build/include -I/g/g0/dzpolia/src/RAJA/include -
std=c++11 a.cpp

With a.cpp containing

__global__ void callThis(){
}
int main(){
    callThis<<<32,32>>>();
}

I attached the stack trace at the bottom. I replaced my complex compiler plugin
with an absolutely trivial RecursiveASTVisitor one pared down from Eli
Bendersky's samples https://github.com/eliben/llvm-clang-samples (briefly, it
has a VisitStmt method which returns true). The source is attached. Why am I
getting these segfaults?

bash-4.1$ ./buildcmd # contains the above compile line
#0 0x000000000170ec45 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-25/rawbin/clang-4.0+0x170ec45)
#1 0x000000000170f286 SignalHandler(int)
(/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-25/rawbin/clang-4.0+0x170f286)
#2 0x00002aaaaacdd7e0 __restore_rt (/lib64/libpthread.so.0+0xf7e0)
#3 0x00002aaaac27d537 clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseCUDAKernelCallExpr(clang::CUDAKernelCallExpr*,
llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
llvm::PointerLikeTypeTraits<clang::Stmt*>,
llvm::PointerIntPairInfo<clang::Stmt*, 1u,
llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/RecursiveASTVisitor.h:2431:1
#4 0x00002aaaac27d537 clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::dataTraverseNode(clang::Stmt*,
llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
llvm::PointerLikeTypeTraits<clang::Stmt*>,
llvm::PointerIntPairInfo<clang::Stmt*, 1u,
llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/StmtNodes.inc:321:0
#5 0x00002aaaac279472 clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseStmt(clang::Stmt*,
llvm::SmallVectorImpl<llvm::PointerIntPair<clang::Stmt*, 1u, bool,
llvm::PointerLikeTypeTraits<clang::Stmt*>,
llvm::PointerIntPairInfo<clang::Stmt*, 1u,
llvm::PointerLikeTypeTraits<clang::Stmt*> > > >*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/RecursiveASTVisitor.h:623:7
#6 0x00002aaaac283d94 clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseFunctionHelper(clang::FunctionDecl*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/RecursiveASTVisitor.h:1921:5
#7 0x00002aaaac2774f5 clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseDecl(clang::Decl*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/DeclNodes.inc:383:1
#8 0x00002aaaac27622b clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseDeclContextHelper(clang::DeclContext*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/RecursiveASTVisitor.h:1318:7
#9 0x00002aaaac27622b clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseNamespaceDecl(clang::NamespaceDecl*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/RecursiveASTVisitor.h:1434:0
#10 0x00002aaaac27622b clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseDecl(clang::Decl*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/DeclNodes.inc:105:0
#11 0x00002aaaac2780d6 clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseDeclContextHelper(clang::DeclContext*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/RecursiveASTVisitor.h:1318:7
#12 0x00002aaaac2780d6 clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseTranslationUnitDecl(clang::TranslationUnitDecl*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/RecursiveASTVisitor.h:1410:0
#13 0x00002aaaac2780d6 clang::RecursiveASTVisitor<(anonymous
namespace)::SimpleReproducerVisitor>::TraverseDecl(clang::Decl*)
/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-07/include/clang/AST/DeclNodes.inc:541:0
#14 0x0000000001b73c0c
clang::MultiplexConsumer::HandleTranslationUnit(clang::ASTContext&)
(/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-25/rawbin/clang-4.0+0x1b73c0c)
#15 0x000000000218e9c6 clang::ParseAST(clang::Sema&, bool, bool)
(/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-25/rawbin/clang-4.0+0x218e9c6)
#16 0x0000000001b506ac clang::FrontendAction::Execute()
(/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-25/rawbin/clang-4.0+0x1b506ac)
#17 0x0000000001b1a278
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-25/rawbin/clang-4.0+0x1b1a278)
#18 0x0000000001bc4611
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-25/rawbin/clang-4.0+0x1bc4611)
#19 0x0000000000854554 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-
10-25/rawbin/clang-4.0+0x854554)
#20 0x0000000000852c51 main
(/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-25/rawbin/clang-4.0+0x852c51)
#21 0x00002aaaabef2d1d __libc_start_main /usr/src/debug/glibc-2.12-2-
gc4ccff1/csu/libc-start.c:258:0
#22 0x00000000008500f5 _start
(/collab/usr/global/tools/clang/chaos_5_x86_64_ib/clang-cuda-beta-2016-10-25/rawbin/clang-4.0+0x8500f5)
Quuxplusone commented 8 years ago

Attached SamplePlugin.cpp (4054 bytes, application/octet-stream): Minimal RecursiveASTVisitor plugin sample