[llvm-bugs] [Bug 46265] New: Crash on multidimensional arrays when GPU offloading is enabled

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 10 00:33:12 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46265

            Bug ID: 46265
           Summary: Crash on multidimensional arrays when GPU offloading
                    is enabled
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: coti at cs.uoregon.edu
                CC: llvm-bugs at lists.llvm.org

Created attachment 23594
  --> https://bugs.llvm.org/attachment.cgi?id=23594&action=edit
Reproducer

Hello,

I understand that multidimensional arrays cannot be mapped on a GPU when
offloading is enabled. However, the rest of the program should be able to use
multidimensional arrays.

I am attaching a small piece of code that uses 2D VLAs. Please notice that it
does not even contain any OpenMP directive.

If I compile it without offloading, everything works like a charm:
$ clang -O3 -fopenmp  -o 2d_openmp 2d_openmp.c

If I enable offloading, clang crashes when it sees the first 2D array in the
prototype line 6 
$ clang -O3 -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -o 2d_openmp
2d_openmp.c 
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source,
and associated run script.
Stack dump:
[... full stack below ...]
1.    2d_openmp.c:6:38: current parser token ')'

Wouldn't an error message be more appropriate?

Thanks,
Camille

Some information:
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
bf242c067eaf8041a3505e115e0a827f28e4451a)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix

Full stack displayed (I replaced paths to my directories):

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /my/path//llvm-project/install/bin/clang-11 -cc1
-triple nvptx64-nvidia-cuda -aux-triple powerpc64le-unknown-linux-gnu -S
-disable-free -disable-llvm-verifier -discard-value-names -main-file-name
2d_openmp.c -mrelocation-model pic -pic-level 2 -mthread-model posix
-mframe-pointer=all -fno-rounding-math -fno-verbose-asm -no-integrated-as
-mlink-builtin-bitcode /usr/local/cuda/nvvm/libdevice/libdevice.10.bc
-target-feature +ptx64 -target-sdk-version=10.1 -mlink-builtin-bitcode
/my/path//llvm-project/install/lib/libomptarget-nvptx-sm_70.bc -target-cpu
sm_70 -dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb
-resource-dir /my/path//llvm-project/install/lib/clang/11.0.0 -internal-isystem
/my/path//llvm-project/install/lib/clang/11.0.0/include/openmp_wrappers
-include __clang_openmp_device_functions.h -c-isystem
/packages/gcc/7.3.0/include -c-isystem
/home/users/coti/power9/llvm-project/install/include -cxx-isystem
/packages/gcc/7.3.0/include -cxx-isystem
/home/users/coti/power9/llvm-project/install/include -internal-isystem
/my/path//llvm-project/install/lib/clang/11.0.0/include/ppc_wrappers
-internal-isystem /usr/local/include -internal-isystem
/my/path//llvm-project/install/lib/clang/11.0.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-internal-isystem
/my/path//llvm-project/install/lib/clang/11.0.0/include/ppc_wrappers
-internal-isystem /usr/local/include -internal-isystem
/my/path//llvm-project/install/lib/clang/11.0.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fno-dwarf-directory-asm -fdebug-compilation-dir /home/users/coti -ferror-limit
19 -fopenmp -fgnuc-version=4.2.1 -fcolor-diagnostics -vectorize-loops
-vectorize-slp -fopenmp-is-device -fopenmp-host-ir-file-path
/tmp/2d_openmp-ec7c1a.bc -o /tmp/2d_openmp-d66ce7.s -x c 2d_openmp.c 
1.      2d_openmp.c:6:39: current parser token ')'
 #0 0x0000000012917c98 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/my/path//llvm-project/install/bin/clang-11+0x12917c98)
 #1 0x0000000012917dc0 PrintStackTraceSignalHandler(void*)
(/my/path//llvm-project/install/bin/clang-11+0x12917dc0)
 #2 0x00000000129156b8 llvm::sys::RunSignalHandlers()
(/my/path//llvm-project/install/bin/clang-11+0x129156b8)
 #3 0x00000000129158ac SignalHandler(int)
(/my/path//llvm-project/install/bin/clang-11+0x129158ac)
 #4 0x00007fffa5f504d8  0x4d8
clang::Sema::getEmissionStatus(clang::FunctionDecl*, bool)
 #5 0x00007fffa5f504d8 
 #6 0x00007fffa5f504d8
clang::Sema::diagIfOpenMPDeviceCode(clang::SourceLocation, unsigned int)
(+0x4d8)
 #7 0x000000000000002a 
 #8 0x0000000014b9db74 clang::Sema::targetDiag(clang::SourceLocation, unsigned
int) (/my/path//llvm-project/install/bin/clang-11+0x14b9db74)
 #9 0x0000000014f32670 clang::Sema::BuildArrayType(clang::QualType,
clang::ArrayType::ArraySizeModifier, clang::Expr*, unsigned int,
clang::SourceRange, clang::DeclarationName)
(/my/path//llvm-project/install/bin/clang-11+0x14f32670)
#10 0x0000000014a63d34 GetFullTypeForDeclarator((anonymous
namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*)
(/my/path//llvm-project/install/bin/clang-11+0x14a63d34)
#11 0x000000001522e0e8 clang::Sema::GetTypeForDeclarator(clang::Declarator&,
clang::Scope*) (/my/path//llvm-project/install/bin/clang-11+0x1522e0e8)
#12 0x0000000015230ae4 clang::Sema::ActOnParamDeclarator(clang::Scope*,
clang::Declarator&) (/my/path//llvm-project/install/bin/clang-11+0x15230ae4)
#13 0x0000000015236c80
clang::Parser::ParseParameterDeclarationClause(clang::DeclaratorContext,
clang::ParsedAttributes&,
llvm::SmallVectorImpl<clang::DeclaratorChunk::ParamInfo>&,
clang::SourceLocation&)
(/my/path//llvm-project/install/bin/clang-11+0x15236c80)
#14 0x0000000014ba5640
clang::Parser::ParseFunctionDeclarator(clang::Declarator&,
clang::ParsedAttributes&, clang::BalancedDelimiterTracker&, bool, bool)
(/my/path//llvm-project/install/bin/clang-11+0x14ba5640)
#15 0x000000001497db24 clang::Parser::ParseDirectDeclarator(clang::Declarator&)
(/my/path//llvm-project/install/bin/clang-11+0x1497db24)
#16 0x000000001497eafc
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&))
(/my/path//llvm-project/install/bin/clang-11+0x1497eafc)
#17 0x0000000014980630 clang::Parser::ParseDeclarator(clang::Declarator&)
(/my/path//llvm-project/install/bin/clang-11+0x14980630)
#18 0x000000001496c49c clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/my/path//llvm-project/install/bin/clang-11+0x1496c49c)
#19 0x000000001496cad4
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/my/path//llvm-project/install/bin/clang-11+0x1496cad4)
#20 0x000000001497bebc
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) (.part.230)
(/my/path//llvm-project/install/bin/clang-11+0x1497bebc)
#21 0x0000000014949868
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/my/path//llvm-project/install/bin/clang-11+0x14949868)
#22 0x000000001494a3d4
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool)
(/my/path//llvm-project/install/bin/clang-11+0x1494a3d4)
#23 0x000000001495148c clang::ParseAST(clang::Sema&, bool, bool)
(/my/path//llvm-project/install/bin/clang-11+0x1495148c)
#24 0x0000000014952ea8 clang::ASTFrontendAction::ExecuteAction()
(/my/path//llvm-project/install/bin/clang-11+0x14952ea8)
#25 0x0000000014944628 clang::CodeGenAction::ExecuteAction()
(/my/path//llvm-project/install/bin/clang-11+0x14944628)
#26 0x00000000131f1058 clang::FrontendAction::Execute()
(/my/path//llvm-project/install/bin/clang-11+0x131f1058)
#27 0x00000000138aea44
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/my/path//llvm-project/install/bin/clang-11+0x138aea44)
#28 0x00000000131f9e0c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/my/path//llvm-project/install/bin/clang-11+0x131f9e0c)
#29 0x00000000131b1e60 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/my/path//llvm-project/install/bin/clang-11+0x131b1e60)
#30 0x00000000132ea0e4 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/my/path//llvm-project/install/bin/clang-11+0x132ea0e4)
#31 0x000000001065f80c main
(/my/path//llvm-project/install/bin/clang-11+0x1065f80c)
#32 0x000000001065bbbc generic_start_main.isra.0
(/my/path//llvm-project/install/bin/clang-11+0x1065bbbc)
#33 0x000000001059ebac __libc_start_main
(/my/path//llvm-project/install/bin/clang-11+0x1059ebac)
/my/path//llvm-project/install/bin/clang-11(_ZN4llvm3sys15PrintStackTraceERNS_11raw_ostreamE+0x38)[0x12917c98]
/my/path//llvm-project/install/bin/clang-11[0x12917dc0]
/my/path//llvm-project/install/bin/clang-11(_ZN4llvm3sys17RunSignalHandlersEv+0x78)[0x129156b8]
/my/path//llvm-project/install/bin/clang-11[0x129158ac]
[0x7fffa5f504d8]
[0x2a]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang4Sema17getEmissionStatusEPNS_12FunctionDeclEb+0x34)[0x14b9db74]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang4Sema22diagIfOpenMPDeviceCodeENS_14SourceLocationEj+0x50)[0x14f32670]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang4Sema10targetDiagENS_14SourceLocationEj+0xa4)[0x14a63d34]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang4Sema14BuildArrayTypeENS_8QualTypeENS_9ArrayType17ArraySizeModifierEPNS_4ExprEjNS_11SourceRangeENS_15DeclarationNameE+0x928)[0x1522e0e8]
/my/path//llvm-project/install/bin/clang-11[0x15230ae4]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang4Sema20GetTypeForDeclaratorERNS_10DeclaratorEPNS_5ScopeE+0xf0)[0x15236c80]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang4Sema20ActOnParamDeclaratorEPNS_5ScopeERNS_10DeclaratorE+0x160)[0x14ba5640]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang6Parser31ParseParameterDeclarationClauseENS_17DeclaratorContextERNS_16ParsedAttributesERN4llvm15SmallVectorImplINS_15DeclaratorChunk9ParamInfoEEERNS_14SourceLocationE+0x354)[0x1497db24]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang6Parser23ParseFunctionDeclaratorERNS_10DeclaratorERNS_16ParsedAttributesERNS_24BalancedDelimiterTrackerEbb+0x29c)[0x1497eafc]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang6Parser21ParseDirectDeclaratorERNS_10DeclaratorE+0xcf0)[0x14980630]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang6Parser23ParseDeclaratorInternalERNS_10DeclaratorEMS0_FvS2_E+0x6ec)[0x1496c49c]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang6Parser15ParseDeclaratorERNS_10DeclaratorE+0x24)[0x1496cad4]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang6Parser14ParseDeclGroupERNS_15ParsingDeclSpecENS_17DeclaratorContextEPNS_14SourceLocationEPNS0_12ForRangeInitE+0x13c)[0x1497bebc]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang6Parser30ParseDeclOrFunctionDefInternalERNS0_25ParsedAttributesWithRangeERNS_15ParsingDeclSpecENS_15AccessSpecifierE+0x298)[0x14949868]
/my/path//llvm-project/install/bin/clang-11[0x1494a3d4]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang6Parser24ParseExternalDeclarationERNS0_25ParsedAttributesWithRangeEPNS_15ParsingDeclSpecE+0x7fc)[0x1495148c]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang6Parser17ParseTopLevelDeclERNS_9OpaquePtrINS_12DeclGroupRefEEEb+0x178)[0x14952ea8]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang8ParseASTERNS_4SemaEbb+0x2c8)[0x14944628]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang17ASTFrontendAction13ExecuteActionEv+0x68)[0x131f1058]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang13CodeGenAction13ExecuteActionEv+0x24)[0x138aea44]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang14FrontendAction7ExecuteEv+0x10c)[0x131f9e0c]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang16CompilerInstance13ExecuteActionERNS_14FrontendActionE+0x210)[0x131b1e60]
/my/path//llvm-project/install/bin/clang-11(_ZN5clang25ExecuteCompilerInvocationEPNS_16CompilerInstanceE+0xba4)[0x132ea0e4]
/my/path//llvm-project/install/bin/clang-11(_Z8cc1_mainN4llvm8ArrayRefIPKcEES2_Pv+0x122c)[0x1065f80c]
/my/path//llvm-project/install/bin/clang-11[0x1065bbbc]
/my/path//llvm-project/install/bin/clang-11(main+0xe2c)[0x1059ebac]
/lib64/libc.so.6(+0x25200)[0x7fffa3dd5200]
/lib64/libc.so.6(__libc_start_main+0xc4)[0x7fffa3dd53f4]
clang-11: error: unable to execute command: Segmentation fault
clang-11: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 11.0.0 (https://github.com/llvm/llvm-project.git
bf242c067eaf8041a3505e115e0a827f28e4451a)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/users/coti/power9/llvm-project/install/bin
clang-11: note: diagnostic msg: Error generating preprocessed source(s).

-- 
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/20200610/f6621e26/attachment-0001.html>


More information about the llvm-bugs mailing list