CTSRD-CHERI / clang

DO NOT USE. Use llvm-project instead
Other
9 stars 8 forks source link

Cannot get layout of forward declarations! #202

Closed nwf closed 6 years ago

nwf commented 6 years ago

Building cheribsd 92646471565f4ac62286b905a22c53814e33ddef (and some changes that I don't think should matter), I get:

>>> stage 4.2: building libraries        
===> lib/libc (obj,all,install)           
Assertion failed: (D && "Cannot get layout of forward declarations!"), function getASTRecordLayout, file /mnt/mainline/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp, line 2970.
#0 0x0000000002fea168 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/junk/cheri-out/sdk/bin/clang-7.0+0x2fea168)
#1 0x0000000002fea566 __assert (/junk/cheri-out/sdk/bin/clang-7.0+0x2fea566)
#2 0x0000000004c7c833 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const (/junk/cheri-out/sdk/bin/clang-7.0+0x4c7c833)
#3 0x0000000004a79568 clang::ASTContext::getDeclAlign(clang::Decl const*, bool) const (/junk/cheri-out/sdk/bin/clang-7.0+0x4a79568)
#4 0x00000000044fa9b3 clang::Sema::CheckAlignasUnderalignment(clang::Decl*) (/junk/cheri-out/sdk/bin/clang-7.0+0x44fa9b3)
#5 0x00000000044d8966 clang::Sema::CheckFieldDecl(clang::DeclarationName, clang::QualType, clang::TypeSourceInfo*, clang::RecordDecl*, clang::SourceLocation, bool, clang::Expr*, clang::InClassInitStyle, clang::SourceLocation, clang::AccessSpecifier, clang::NamedDecl*, clang::Declarator*) (/junk/cheri-out/sdk/bin/clang-7.0+0x44d8966)
#6 0x00000000044d7883 clang::Sema::HandleField(clang::Scope*, clang::RecordDecl*, clang::SourceLocation, clang::Declarator&, clang::Expr*, clang::InClassInitStyle, clang::AccessSpecifier) (/junk/cheri-out/sdk/bin/clang-7.0+0x44d7883)
#7 0x00000000044d6f61 clang::Sema::ActOnField(clang::Scope*, clang::Decl*, clang::SourceLocation, clang::Declarator&, clang::Expr*) (/junk/cheri-out/sdk/bin/clang-7.0+0x44d6f61)
#8 0x000000000413d79a void llvm::function_ref<void (clang::ParsingFieldDeclarator&)>::callback_fn<clang::Parser::ParseStructUnionBody(clang::SourceLocation, unsigned int, clang::Decl*)::$_1>(long, clang::ParsingFieldDeclarator&) (/junk/cheri-out/sdk/bin/clang-7.0+0x413d79a)
#9 0x0000000004132f1c clang::Parser::ParseStructDeclaration(clang::ParsingDeclSpec&, llvm::function_ref<void (clang::ParsingFieldDeclarator&)>) (/junk/cheri-out/sdk/bin/clang-7.0+0x4132f1c)
#10 0x0000000004133664 clang::Parser::ParseStructUnionBody(clang::SourceLocation, unsigned int, clang::Decl*) (/junk/cheri-out/sdk/bin/clang-7.0+0x4133664)
#11 0x000000000410b41f clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::Parser::ParsedAttributesWithRange&) (/junk/cheri-out/sdk/bin/clang-7.0+0x410b41f)
#12 0x0000000004128c6a clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) (/junk/cheri-out/sdk/bin/clang-7.0+0x4128c6a)
#13 0x00000000041284c7 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*) (/junk/cheri-out/sdk/bin/clang-7.0+0x41284c7)
#14 0x00000000041282a1 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) (/junk/cheri-out/sdk/bin/clang-7.0+0x41282a1)
#15 0x00000000040fbcda clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/junk/cheri-out/sdk/bin/clang-7.0+0x40fbcda)
#16 0x00000000040fb596 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/junk/cheri-out/sdk/bin/clang-7.0+0x40fb596)
#17 0x00000000040f6e56 clang::ParseAST(clang::Sema&, bool, bool) (/junk/cheri-out/sdk/bin/clang-7.0+0x40f6e56)
#18 0x00000000036a5e19 clang::FrontendAction::Execute() (/junk/cheri-out/sdk/bin/clang-7.0+0x36a5e19)
#19 0x000000000362ecd1 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/junk/cheri-out/sdk/bin/clang-7.0+0x362ecd1)
#20 0x0000000003742285 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/junk/cheri-out/sdk/bin/clang-7.0+0x3742285)
#21 0x00000000017b202a cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/junk/cheri-out/sdk/bin/clang-7.0+0x17b202a)
#22 0x00000000017afede main (/junk/cheri-out/sdk/bin/clang-7.0+0x17afede)
Stack dump:
0.      Program arguments: /junk/cheri-out/sdk/bin/clang-7.0 -cc1 -triple cheri-unknown-freebsd -emit-obj -disable-free -main-file-name cheri_printf.c -mrelocation-model pic -pic-level 1 -mthread-model posix -mdisable-fp-elim -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu cheri128 -target-feature -noabicalls -target-feature +soft-float -target-feature +chericap -target-feature +cheri128 -target-abi purecap -Wmips-cheri-prototypes -msoft-float -mfloat-abi soft -mllvm -mxgot -mllvm -mips-ssection-threshold=0 -cheri-size 128 -mllvm -cheri-cap-table-abi=pcrel -mllvm -mxcaptable=false -dwarf-column-info -debug-info-kind=standalone -dwarf-version=2 -debugger-tuning=gdb -coverage-notes-file /junk/cheri-build/cheribsd-obj-128/mnt/mainline/cheribsd/mips.mips64/lib/libc_cheri/cheri_printf.gcno -resource-dir /junk/cheri-out/sdk/lib/clang/7.0.0 -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/include -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/locale -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/mips -I /mnt/mainline/cheribsd/lib/libc_cheri/../libcheri -I /mnt/mainline/cheribsd/lib/libc_cheri/../libmalloc_simple -I /mnt/mainline/cheribsd/lib/libc_cheri/../../contrib/gdtoa -I /mnt/mainline/cheribsd/lib/libc_cheri/../../contrib/tzcode/stdtime -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/include -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/mips -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/mips/softfloat -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/locale -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/regex -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/softfloat -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/string -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/stdlib -I /mnt/mainline/cheribsd/lib/libc_cheri/../libc/stdtime -I /mnt/mainline/cheribsd/lib/libc_cheri/../../contrib/gdtoa -I /mnt/mainline/cheribsd/lib/libc_cheri/../../include -D FORCE_C_LOCALE -D FORCE_UTC_TZ -D __LP64__=1 -isysroot /junk/cheri-build/cheribsd-obj-128/mnt/mainline/cheribsd/mips.mips64/tmp -O2 -Wno-deprecated-declarations -Wno-cast-align -Werror=implicit-function-declaration -Werror=cheri-bitwise-operations -Wsystem-headers -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=tautological-constant-compare -std=gnu99 -fconst-strings -fdebug-compilation-dir /junk/cheri-build/cheribsd-obj-128/mnt/mainline/cheribsd/mips.mips64/lib/libc_cheri -ferror-limit 19 -fmessage-length 0 -ftls-model=local-exec -fobjc-runtime=gnustep -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -cheri-linker -mllvm -mxmxgot -o cheri_printf.o -x c /mnt/mainline/cheribsd/lib/libc_cheri/cheri_printf.c 
1.      /junk/cheri-build/cheribsd-obj-128/mnt/mainline/cheribsd/mips.mips64/tmp/usr/include/sys/_types.h:106:55: current parser token ';'
2.      /junk/cheri-build/cheribsd-obj-128/mnt/mainline/cheribsd/mips.mips64/tmp/usr/include/sys/_types.h:105:9: parsing struct/union body '(anonymous)'
#0 0x0000000002fea168 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/junk/cheri-out/sdk/bin/clang-7.0+0x2fea168)
#1 0x0000000002fe8288 llvm::sys::RunSignalHandlers() (/junk/cheri-out/sdk/bin/clang-7.0+0x2fe8288)
#2 0x0000000002fea7f2 SignalHandler(int) (/junk/cheri-out/sdk/bin/clang-7.0+0x2fea7f2)
#3 0x0000000804e20166 handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
clang-7.0: error: unable to execute command: Abort trap (core dumped)
clang-7.0: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 7.0.0 (https://github.com/CTSRD-CHERI/clang.git aab28c39957c80e5ca4f14f9eae7b1126bb56583) (https://github.com/CTSRD-CHERI/llvm.git 58431e37e25b84fd2db38ee9a697d8ce90945d57)
Target: cheri-unknown-freebsd
Thread model: posix
InstalledDir: /junk/cheri-out/sdk/bin
clang-7.0: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang-7.0: note: diagnostic msg: 
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-7.0: note: diagnostic msg: /tmp/cheri_printf-8ce297.c
clang-7.0: note: diagnostic msg: /tmp/cheri_printf-8ce297.sh
clang-7.0: note: diagnostic msg: 
********************
--- cheri_printf.o ---
*** [cheri_printf.o] Error code 254
make[4]: stopped in /mnt/mainline/cheribsd/lib/libc_cheri
1 error
make[4]: stopped in /mnt/mainline/cheribsd/lib/libc_cheri
--- lib/libc_cheri__L ---
*** [lib/libc_cheri__L] Error code 2
make[3]: stopped in /mnt/mainline/cheribsd
A failure has been detected in another branch of the parallel make
make[4]: stopped in /mnt/mainline/cheribsd/lib/libc
--- lib/libc__L ---
*** [lib/libc__L] Error code 2
make[3]: stopped in /mnt/mainline/cheribsd
2 errors
make[3]: stopped in /mnt/mainline/cheribsd
--- libraries ---
*** [libraries] Error code 2
make[2]: stopped in /mnt/mainline/cheribsd
1 error
make[2]: stopped in /mnt/mainline/cheribsd
--- _libraries ---
*** [_libraries] Error code 2
make[1]: stopped in /mnt/mainline/cheribsd
1 error
make[1]: stopped in /mnt/mainline/cheribsd
--- buildworld ---
*** [buildworld] Error code 2
1 error
make: stopped in /mnt/mainline/cheribsd
make: stopped in /mnt/mainline/cheribsd
Command "nice make CHERI=128 CHERI_CC=/junk/cheri-out/sdk/bin/ccache-clang CHERI_CXX=/junk/cheri-out/sdk/bin/ccache-clang++ CHERI_LD=/junk/cheri-out/sdk/bin/ld.lld TARGET=mips TARGET_ARCH=mips64 -DDB_FROM_SRC -DNO_CLEAN -DNO_ROOT -DWITHOUT_GDB DEBUG_FLAGS=-g CHERI_USE_CAP_TABLE=pcrel -DWITHOUT_DEBUG_FILES -DWITHOUT_TESTS -DWITHOUT_MAN -DWITHOUT_KERBEROS -DWITHOUT_SVN -DWITHOUT_SVNLITE -DWITHOUT_MAIL -DWITHOUT_SENDMAIL -DWITHOUT_EXAMPLES -DWITHOUT_LOCALES -DWITHOUT_NLS -DWITHOUT_CDDL -DWITHOUT_LLD_IS_LD -DWITH_AUTO_OBJ -DWITHOUT_GCC -DWITHOUT_CLANG -DWITHOUT_GCC_BOOTSTRAP -DWITHOUT_CLANG_BOOTSTRAP -DWITHOUT_LLD_BOOTSTRAP -DWITHOUT_LIB32 -DWITHOUT_RESCUE -DWITHOUT_BOOT -DWITHOUT_BINUTILS_BOOTSTRAP -s buildworld -j2" failed with exit code 2.

The requested files are attached.

bug.zip

nwf commented 6 years ago

Nevermind; fixed already (by 4ec163fcae99416dad3644a38a9c322bc0c03978?)! Thanks. <3