[llvm-bugs] [Bug 28289] New: crash on invalid code on x86_64-linux-gnu ( Assertion `Permissive || !(!LabelAndGotoScopes.count(TheLabel->getStmt()))' failed.)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 24 03:05:51 PDT 2016


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

            Bug ID: 28289
           Summary: crash on invalid code on x86_64-linux-gnu ( Assertion
                    `Permissive ||
                    !(!LabelAndGotoScopes.count(TheLabel->getStmt()))'
                    failed.)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

This is a regression. clang-3.8 does not crash. 

$: clang++-trunk -v
clang version 3.9.0 (trunk 272938) (llvm/trunk 272936)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$: 
$: clang++-trunk small.C
small.C:3:15: error: use of undeclared label 'begin'
  void *a = &&begin;
              ^
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/JumpDiagnostics.cpp:627:
void {anonymous}::JumpScopeChecker::VerifyIndirectJumps(): Assertion
`Permissive || !(!LabelAndGotoScopes.count(TheLabel->getStmt()))' failed.
#0 0x0000000001c6b8b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c6b8b5)
#1 0x0000000001c69776 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1c69776)
#2 0x0000000001c69994 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1c69994)
#3 0x00007fc78836c8d0 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0xf8d0)
#4 0x00007fc7875aa067 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x35067)
#5 0x00007fc7875ab448 abort (/lib/x86_64-linux-gnu/libc.so.6+0x36448)
#6 0x00007fc7875a3266 (/lib/x86_64-linux-gnu/libc.so.6+0x2e266)
#7 0x00007fc7875a3312 (/lib/x86_64-linux-gnu/libc.so.6+0x2e312)
#8 0x0000000002cd4cd7 (anonymous
namespace)::JumpScopeChecker::VerifyIndirectJumps()
(/usr/local/clang-trunk/bin/clang-3.9+0x2cd4cd7)
#9 0x0000000002cd7130 clang::Sema::DiagnoseInvalidJumps(clang::Stmt*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2cd7130)
#10 0x000000000293220f clang::Sema::ActOnFinishFunctionBody(clang::Decl*,
clang::Stmt*, bool) (/usr/local/clang-trunk/bin/clang-3.9+0x293220f)
#11 0x0000000002c8681b
clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation,
clang::FunctionDecl*, bool, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x2c8681b)
#12 0x0000000002c59150
clang::Sema::InstantiateClassMembers(clang::SourceLocation,
clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&,
clang::TemplateSpecializationKind)
(/usr/local/clang-trunk/bin/clang-3.9+0x2c59150)
#13 0x0000000002c598a6
clang::Sema::InstantiateClassTemplateSpecializationMembers(clang::SourceLocation,
clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind)
(/usr/local/clang-trunk/bin/clang-3.9+0x2c598a6)
#14 0x0000000002c00e51 clang::Sema::ActOnExplicitInstantiation(clang::Scope*,
clang::SourceLocation, clang::SourceLocation, unsigned int,
clang::SourceLocation, clang::CXXScopeSpec const&,
clang::OpaquePtr<clang::TemplateName>, clang::SourceLocation,
clang::SourceLocation, llvm::MutableArrayRef<clang::ParsedTemplateArgument>,
clang::SourceLocation, clang::AttributeList*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2c00e51)
#15 0x00000000026d78b4
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-3.9+0x26d78b4)
#16 0x00000000026b96f9
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-3.9+0x26b96f9)
#17 0x000000000272b611
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/usr/local/clang-trunk/bin/clang-3.9+0x272b611)
#18 0x000000000272d2d3 clang::Parser::ParseExplicitInstantiation(unsigned int,
clang::SourceLocation, clang::SourceLocation, clang::SourceLocation&,
clang::AccessSpecifier) (/usr/local/clang-trunk/bin/clang-3.9+0x272d2d3)
#19 0x000000000272d4ac
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*)
(/usr/local/clang-trunk/bin/clang-3.9+0x272d4ac)
#20 0x00000000026c42c4 clang::Parser::ParseDeclaration(unsigned int,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-3.9+0x26c42c4)
#21 0x00000000026a1122
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-3.9+0x26a1122)
#22 0x00000000026a18b0
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x26a18b0)
#23 0x000000000269c16b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x269c16b)
#24 0x000000000236afbb clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x236afbb)
#25 0x000000000209aa4e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x209aa4e)
#26 0x0000000002071526
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2071526)
#27 0x0000000002123942
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2123942)
#28 0x0000000000b0eba8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xb0eba8)
#29 0x0000000000ac3325 main (/usr/local/clang-trunk/bin/clang-3.9+0xac3325)
#30 0x00007fc787596b45 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b45)
#31 0x0000000000b0ad04 _start (/usr/local/clang-trunk/bin/clang-3.9+0xb0ad04)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.C -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.9.0 -c-isystem .
-c-isystem /usr/local/include/csmith -internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir
/home/cnsun/workspace/meta-compiler/error-fuzzer/temp-runs/IdentifierSubstituionFuzzingEngine/crash/20160618-clang++-trunk--O3-c-Weverything-std=c++14-build-153128
-ferror-limit 19 -fmessage-length 270 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/small-878340.o -x c++ small.C 
1.    small.C:7:22: current parser token ';'
2.    small.C:1:34: instantiating function definition 'A<int>::m'
clang-3.9: error: unable to execute command: Aborted
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 272938) (llvm/trunk 272936)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-3.9: 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-3.9: 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.9: note: diagnostic msg: /tmp/small-f303a9.cpp
clang-3.9: note: diagnostic msg: /tmp/small-f303a9.sh
clang-3.9: note: diagnostic msg: 

********************
$: 
$: clang++-3.8 small.C
small.C:3:15: error: use of undeclared label 'begin'
  void *a = &&begin;
              ^
1 error generated.
$: 
$: cat small.C
template <class> struct A { void m(); };
template <class T> void A<T>::m() {
  void *a = &&begin;
  goto *a;
}

template class A<int>;
$:

-- 
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/20160624/d0a41ad0/attachment-0001.html>


More information about the llvm-bugs mailing list