[llvm-bugs] [Bug 35509] New: Segmentation fault in clang::Sema::ActOnCastExpr -> clang::ASTContext::getASTRecordLayout

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Dec 3 10:07:45 PST 2017


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

            Bug ID: 35509
           Summary: Segmentation fault in clang::Sema::ActOnCastExpr ->
                    clang::ASTContext::getASTRecordLayout
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: waddlesplash at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 19512
  --> https://bugs.llvm.org/attachment.cgi?id=19512&action=edit
gzip of the faulting file

This occurred while trying to compile Haiku (https://www.haiku-os.org) with
Clang 5.0 on Ubuntu 17.10. I've heard reports that it occurs on other systems
as well; and started occuring sometime in the last couple releases.

#0 0x00007ff80342bdfa llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/lib/llvm-5.0/bin/../lib/libLLVM-5.0.so.1+0x7aadfa)
#1 0x00007ff80342a016 llvm::sys::RunSignalHandlers()
(/usr/lib/llvm-5.0/bin/../lib/libLLVM-5.0.so.1+0x7a9016)
#2 0x00007ff80342a14b (/usr/lib/llvm-5.0/bin/../lib/libLLVM-5.0.so.1+0x7a914b)
#3 0x00007ff80629c150 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x13150)
#4 0x0000561b62f34025 clang::ASTContext::getASTRecordLayout(clang::RecordDecl
const*) const (/usr/lib/llvm-5.0/bin/clang+0x1892025)
#5 0x0000561b62dc05da clang::ASTContext::getTypeInfoImpl(clang::Type const*)
const (/usr/lib/llvm-5.0/bin/clang+0x171e5da)
#6 0x0000561b62db87c5 clang::ASTContext::getTypeInfo(clang::Type const*) const
(/usr/lib/llvm-5.0/bin/clang+0x17167c5)
#7 0x0000561b62db8aa0 clang::ASTContext::getTypeAlignInChars(clang::QualType)
const (/usr/lib/llvm-5.0/bin/clang+0x1716aa0)
#8 0x0000561b624aae0a clang::Sema::DiscardMisalignedMemberAddress(clang::Type
const*, clang::Expr*) (/usr/lib/llvm-5.0/bin/clang+0xe08e0a)
#9 0x0000561b6267f065 clang::Sema::ActOnCastExpr(clang::Scope*,
clang::SourceLocation, clang::Declarator&, clang::OpaquePtr<clang::QualType>&,
clang::SourceLocation, clang::Expr*) (/usr/lib/llvm-5.0/bin/clang+0xfdd065)
#10 0x0000561b622f28d2
clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool,
bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&)
(/usr/lib/llvm-5.0/bin/clang+0xc508d2)
#11 0x0000561b622ea70d clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState, bool) (/usr/lib/llvm-5.0/bin/clang+0xc4870d)
#12 0x0000561b622ec954 clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState, bool) (/usr/lib/llvm-5.0/bin/clang+0xc4a954)
#13 0x0000561b622edeec
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/usr/lib/llvm-5.0/bin/clang+0xc4beec)
#14 0x0000561b622eea99
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/usr/lib/llvm-5.0/bin/clang+0xc4ca99)
#15 0x0000561b62330772 clang::Parser::ParseReturnStatement()
(/usr/lib/llvm-5.0/bin/clang+0xc8e772)
#16 0x0000561b62332b9f
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/lib/llvm-5.0/bin/clang+0xc90b9f)
#17 0x0000561b623337d0
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedConstructsKind, clang::SourceLocation*)
(/usr/lib/llvm-5.0/bin/clang+0xc917d0)
#18 0x0000561b623372c0 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/lib/llvm-5.0/bin/clang+0xc952c0)
#19 0x0000561b623399db clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/lib/llvm-5.0/bin/clang+0xc979db)
#20 0x0000561b622aa513
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/lib/llvm-5.0/bin/clang+0xc08513)
#21 0x0000561b622cb479 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/lib/llvm-5.0/bin/clang+0xc29479)
#22 0x0000561b622a5c71
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/lib/llvm-5.0/bin/clang+0xc03c71)
#23 0x0000561b622a62c1 (/usr/lib/llvm-5.0/bin/clang+0xc042c1)
#24 0x0000561b622ac5c5
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/lib/llvm-5.0/bin/clang+0xc0a5c5)
#25 0x0000561b622ad719
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/lib/llvm-5.0/bin/clang+0xc0b719)
#26 0x0000561b622a23d2 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/lib/llvm-5.0/bin/clang+0xc003d2)
#27 0x0000561b62055c57 clang::CodeGenAction::ExecuteAction()
(/usr/lib/llvm-5.0/bin/clang+0x9b3c57)
#28 0x0000561b61ecd176 clang::FrontendAction::Execute()
(/usr/lib/llvm-5.0/bin/clang+0x82b176)
#29 0x0000561b61e9982c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/lib/llvm-5.0/bin/clang+0x7f782c)
#30 0x0000561b61f6dcd3
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/lib/llvm-5.0/bin/clang+0x8cbcd3)
#31 0x0000561b61acfe78 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/lib/llvm-5.0/bin/clang+0x42de78)
#32 0x0000561b61abf544 main (/usr/lib/llvm-5.0/bin/clang+0x41d544)
#33 0x00007ff801d9d1c1 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x211c1)
#34 0x0000561b61acdbaa _start (/usr/lib/llvm-5.0/bin/clang+0x42bbaa)
Stack dump:
0.      Program arguments: /usr/lib/llvm-5.0/bin/clang -cc1 -triple
x86_64-unknown-haiku -S -disable-free -disable-llvm-verifier
-discard-value-names -main-file-name BlockAllocator.cpp -mrelocation-model pic
-pic-level 2 -pic-is-pie -mthread-model posix -mdisable-fp-elim
-relaxed-aliasing -fmath-errno -masm-verbose -no-integrated-as
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -disable-red-zone
-dwarf-column-info -debugger-tuning=gdb -coverage-notes-file
/home/augustin/haiku/generated/objects/haiku/x86_64/release/add-ons/kernel/file_systems/bfs/BlockAllocator.gcno
-nostdsysteminc -nobuiltininc -resource-dir /usr/lib/llvm-5.0/lib/clang/5.0.0
-iquote /home/augustin/haiku/build/user_config_headers -iquote
/home/augustin/haiku/build/config_headers -iquote
/home/augustin/haiku/src/add-ons/kernel/file_systems/bfs -iquote
/home/augustin/haiku/generated/objects/common/add-ons/kernel/file_systems/bfs
-iquote
/home/augustin/haiku/generated/objects/linux/x86_64/common/add-ons/kernel/file_systems/bfs
-iquote
/home/augustin/haiku/generated/objects/haiku/x86_64/common/add-ons/kernel/file_systems/bfs
-D BFS_DEBUGGER_COMMANDS -D _KERNEL_MODE -D ARCH_x86_64 -D
B_USE_BUILTIN_ATOMIC_FUNCTIONS -D BOOT_ARCHIVE_IMAGE_OFFSET=320 -D
__HAIKU_PRIMARY_PACKAGING_ARCH="x86_64" -D HAIKU_DISTRO_COMPATIBILITY_DEFAULT
-D HAIKU_INCLUDE_PATENTED_CODE=0 -D HAIKU_TARGET_PLATFORM_HAIKU -D
HAIKU_REGULAR_BUILD -I /home/augustin/haiku/headers/private/. -I
/home/augustin/haiku/headers/private/kernel -I
/home/augustin/haiku/headers/private/libroot -I
/home/augustin/haiku/headers/private/shared -I
/home/augustin/haiku/headers/private/kernel/boot/platform/bios_ia32 -I
/home/augustin/haiku/headers/private/kernel/arch/x86 -I
/home/augustin/haiku/generated/objects/haiku/x86_64/common/system/kernel -I
/home/augustin/haiku/headers/private/. -I
/home/augustin/haiku/headers/private/system -I
/home/augustin/haiku/headers/private/system/arch/x86_64 -I
/home/augustin/haiku/headers/private/kernel/disk_device_manager -I
/home/augustin/haiku/headers/private/shared -I
/home/augustin/haiku/headers/private/storage -I
/home/augustin/haiku/headers/clang -I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/c++
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/c++/x86_64-unknown-haiku
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/c++/backward
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/c++/ext
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/gcc/include
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/gcc/include-fixed
-I /home/augustin/haiku/headers -I /home/augustin/haiku/headers/posix -I
/home/augustin/haiku/headers/glibc -I /home/augustin/haiku/headers/os -I
/home/augustin/haiku/headers/os/add-ons -I
/home/augustin/haiku/headers/os/add-ons/file_system -I
/home/augustin/haiku/headers/os/add-ons/graphics -I
/home/augustin/haiku/headers/os/add-ons/input_server -I
/home/augustin/haiku/headers/os/add-ons/registrar -I
/home/augustin/haiku/headers/os/add-ons/screen_saver -I
/home/augustin/haiku/headers/os/add-ons/tracker -I
/home/augustin/haiku/headers/os/app -I /home/augustin/haiku/headers/os/device
-I /home/augustin/haiku/headers/os/drivers -I
/home/augustin/haiku/headers/os/game -I
/home/augustin/haiku/headers/os/interface -I
/home/augustin/haiku/headers/os/kernel -I
/home/augustin/haiku/headers/os/locale -I /home/augustin/haiku/headers/os/media
-I /home/augustin/haiku/headers/os/mail -I /home/augustin/haiku/headers/os/midi
-I /home/augustin/haiku/headers/os/midi2 -I /home/augustin/haiku/headers/os/net
-I /home/augustin/haiku/headers/os/storage -I
/home/augustin/haiku/headers/os/support -I
/home/augustin/haiku/headers/os/translation -I
/home/augustin/haiku/headers/private/. -internal-isystem
/usr/include/clang/5.0.0/include/ -O1 -Wall -Wno-trigraphs -Wno-multichar
-Wno-array-bounds -Wno-deprecated -Wno-array-bounds -Wno-deprecated
-Wno-array-bounds -std=gnu++11 -fno-dwarf-directory-asm -fdebug-compilation-dir
/home/augustin/haiku/generated -ferror-limit 19 -fmessage-length 0
-ffreestanding -fno-builtin -fobjc-runtime=gcc -fdiagnostics-show-option -o
/tmp/BlockAllocator-f819b1.s -x c++
/home/augustin/haiku/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp
1.     
/home/augustin/haiku/src/add-ons/kernel/file_systems/bfs/BPlusTree.h:609:41:
current parser token ';'
2.     
/home/augustin/haiku/src/add-ons/kernel/file_systems/bfs/BPlusTree.h:608:1:
parsing function body 'bplustree_node::DuplicateArray'
3.     
/home/augustin/haiku/src/add-ons/kernel/file_systems/bfs/BPlusTree.h:608:1: in
compound statement ('{}')
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0-3 (tags/RELEASE_500/final)
Target: x86_64-unknown-haiku
Thread model: posix
InstalledDir: /usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.

clang-5.0 -target x86_64-unknown-haiku -no-integrated-as -c
"/home/augustin/haiku/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp"
-O1 -Wall -Wno-trigraphs -Wno-multichar -fno-strict-aliasing -fno-builtin-vfork
-Wno-array-bounds -nostdinc -Wno-deprecated -DBFS_DEBUGGER_COMMANDS
-fno-strict-aliasing -fno-builtin-vfork -Wno-array-bounds -nostdinc
-Wno-deprecated -fno-strict-aliasing -fno-builtin-vfork -Wno-array-bounds
-finline -fno-builtin -ffreestanding -fno-exceptions -std=gnu++11 -mno-red-zone
-fno-omit-frame-pointer -D_KERNEL_MODE -DARCH_x86_64
-DB_USE_BUILTIN_ATOMIC_FUNCTIONS -DBOOT_ARCHIVE_IMAGE_OFFSET=320
-D__HAIKU_PRIMARY_PACKAGING_ARCH=\"x86_64\"
-DHAIKU_DISTRO_COMPATIBILITY_DEFAULT -DHAIKU_INCLUDE_PATENTED_CODE=0
-DHAIKU_TARGET_PLATFORM_HAIKU -DHAIKU_REGULAR_BUILD -iquote
/home/augustin/haiku/build/user_config_headers -iquote
/home/augustin/haiku/build/config_headers -iquote
/home/augustin/haiku/src/add-ons/kernel/file_systems/bfs -iquote
/home/augustin/haiku/generated/objects/common/add-ons/kernel/file_systems/bfs
-iquote
/home/augustin/haiku/generated/objects/linux/x86_64/common/add-ons/kernel/file_systems/bfs
-iquote
/home/augustin/haiku/generated/objects/haiku/x86_64/common/add-ons/kernel/file_systems/bfs
-I /home/augustin/haiku/headers/private/. -I
/home/augustin/haiku/headers/private/kernel -I
/home/augustin/haiku/headers/private/libroot -I
/home/augustin/haiku/headers/private/shared -I
/home/augustin/haiku/headers/private/kernel/boot/platform/bios_ia32 -I
/home/augustin/haiku/headers/private/kernel/arch/x86 -I
/home/augustin/haiku/generated/objects/haiku/x86_64/common/system/kernel -I
/home/augustin/haiku/headers/private/. -I
/home/augustin/haiku/headers/private/system -I
/home/augustin/haiku/headers/private/system/arch/x86_64 -I
/home/augustin/haiku/headers/private/kernel/disk_device_manager -I
/home/augustin/haiku/headers/private/shared -I
/home/augustin/haiku/headers/private/storage -I
/home/augustin/haiku/headers/clang -I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/c++
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/c++/x86_64-unknown-haiku
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/c++/backward
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/c++/ext
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/gcc/include
-I
/home/augustin/haiku/generated/build_packages/gcc_syslibs_devel-5.4.0_2016_06_04-6-x86_64/develop/headers/gcc/include-fixed
-I /home/augustin/haiku/headers -I /home/augustin/haiku/headers/posix -I
/home/augustin/haiku/headers/glibc -I /home/augustin/haiku/headers/os -I
/home/augustin/haiku/headers/os/add-ons -I
/home/augustin/haiku/headers/os/add-ons/file_system -I
/home/augustin/haiku/headers/os/add-ons/graphics -I
/home/augustin/haiku/headers/os/add-ons/input_server -I
/home/augustin/haiku/headers/os/add-ons/registrar -I
/home/augustin/haiku/headers/os/add-ons/screen_saver -I
/home/augustin/haiku/headers/os/add-ons/tracker -I
/home/augustin/haiku/headers/os/app -I /home/augustin/haiku/headers/os/device
-I /home/augustin/haiku/headers/os/drivers -I
/home/augustin/haiku/headers/os/game -I
/home/augustin/haiku/headers/os/interface -I
/home/augustin/haiku/headers/os/kernel -I
/home/augustin/haiku/headers/os/locale -I /home/augustin/haiku/headers/os/media
-I /home/augustin/haiku/headers/os/mail -I /home/augustin/haiku/headers/os/midi
-I /home/augustin/haiku/headers/os/midi2 -I /home/augustin/haiku/headers/os/net
-I /home/augustin/haiku/headers/os/storage -I
/home/augustin/haiku/headers/os/support -I
/home/augustin/haiku/headers/os/translation -I
/home/augustin/haiku/headers/private/. -o
"/home/augustin/haiku/generated/objects/haiku/x86_64/release/add-ons/kernel/file_systems/bfs/BlockAllocator.o"
;

clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/BlockAllocator-1726b2.cpp
clang: note: diagnostic msg: /tmp/BlockAllocator-1726b2.sh
clang: note: diagnostic msg:

********************

-- 
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/20171203/fb516a97/attachment-0001.html>


More information about the llvm-bugs mailing list