Closed PHHargrove closed 10 years ago
However, those are "Release" builds and thus lack the failing assertion. So, the problem may be OS-independent. I am investigating that now.
Indeed a Debug build on Mac OS X also fails the assertion. Since the failure includes a full backtrace, not available from the OpenBSD or Solaris failures, I've pasted it below.
$ ./upcnightly/testers64/llvm-upc/bin/upc foo.c
Assertion failed: (isa<TypeDecl>(D) && "Unsupported decl kind"), function EmitTopLevelDecl, file /usr/local/upc/testers64/llvm-upc/src/tools/clang/lib/CodeGen/CodeGenModule.cpp, line 3131.
0 clang-3.4 0x000000010db6768e llvm::sys::PrintStackTrace(__sFILE*) + 46
1 clang-3.4 0x000000010db6799b PrintStackTraceSignalHandler(void*) + 27
2 clang-3.4 0x000000010db67ca9 SignalHandler(int) + 297
3 libsystem_c.dylib 0x00007fff91e2b90a _sigtramp + 26
4 libsystem_c.dylib 0x00007fff5305f978 _sigtramp + 3240312968
5 clang-3.4 0x000000010db679cb raise + 27
6 clang-3.4 0x000000010db67a82 abort + 18
7 clang-3.4 0x000000010db67a61 __assert_rtn + 129
8 clang-3.4 0x000000010e1a5708 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) + 2296
9 clang-3.4 0x000000010e217460 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) + 128
10 clang-3.4 0x000000010e18de55 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) + 181
11 clang-3.4 0x000000010e45a8e7 clang::ParseAST(clang::Sema&, bool, bool) + 503
12 clang-3.4 0x000000010e38bade clang::ASTFrontendAction::ExecuteAction() + 334
13 clang-3.4 0x000000010e18d3b2 clang::CodeGenAction::ExecuteAction() + 1266
14 clang-3.4 0x000000010e38b60f clang::FrontendAction::Execute() + 191
15 clang-3.4 0x000000010e34a350 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 896
16 clang-3.4 0x000000010db6d0f4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1028
17 clang-3.4 0x000000010cba70d7 cc1_main(char const**, char const**, char const*, void*) + 711
18 clang-3.4 0x000000010cb9f1a1 main + 801
19 libdyld.dylib 0x00007fff8e03a7e1 start + 0
Stack dump:
0. Program arguments: /usr/local/upc/testers64/llvm-upc/bin/clang-3.4 -cc1 -triple x86_64-apple-macosx10.8.0 -emit-obj -mrelax-all -disable-free -main-file-name foo.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -resource-dir /usr/local/upc/testers64/llvm-upc/bin/../lib/clang/3.4 -fdebug-compilation-dir /Users/Paul -ferror-limit 19 -fmessage-length 110 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.8.0 -fencode-extended-block-signature -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/b_/m5rd2dz92qvgwk_v_g1m_1yr0000gr/T/foo-f5cf5c.o -x upc foo.c
1. foo.c:2:1: current parser token 'int'
2. foo.c:1:9: LLVM IR generation of declaration
clang-3.4: error: unable to execute command: Illegal instruction: 4
clang-3.4: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 3.4 (UPC 3.4.0-1 20140710)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
clang-3.4: note: diagnostic msg: PLEASE submit a bug report to and include the crash backtrace, preprocessed source, and associated run script.
clang-3.4: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.4: note: diagnostic msg: /var/folders/b_/m5rd2dz92qvgwk_v_g1m_1yr0000gr/T/foo-969424.c
clang-3.4: note: diagnostic msg: /var/folders/b_/m5rd2dz92qvgwk_v_g1m_1yr0000gr/T/foo-969424.sh
clang-3.4: note: diagnostic msg:
********************
AMDG
On 07/11/2014 02:52 PM, Paul H. Hargrove wrote:
However, those are "Release" builds and thus lack the failing assertion. So, the problem may be OS-independent. I am investigating that now.
It is. I was working on clang-upc2c, and I forgot to handle the clang-upc CodeGen. The decl just needs to be skipped.
In Christ, Steven Watanabe
The decl just needs to be skipped.
I am testing a patch that does just that and will commit once I've verified the fix.
-Paul
I have the following 2-line test reduced from gasp_test.upc in the Berkeley suite.
On my OpenBSD-5.5/amd64 and /i386 platforms clang-upc crashes on that simple input:
Here is the .sh "attachment" requested in the error mesage:
On Solaris I see the same problem, with a brand-new build (UPC 3.4.0-1 20140710).
This problem does not occur on my Mac OS X, NetBSD or FreeBSD systems. However, those are "Release" builds and thus lack the failing assertion. So, the problem may be OS-independent. I am investigating that now.
If I had to guess I would say the problem is that the PUPC pragma is being stored in the AST as a decl for which there is no corresponding code in EmitTopLevelDecl().