[llvm-bugs] [Bug 26700] New: clang crashes on x86_64-linux-gnu for undeclared identifier

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Feb 22 12:28:47 PST 2016


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

            Bug ID: 26700
           Summary: clang crashes on x86_64-linux-gnu for undeclared
                    identifier
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: helloqirun at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following test case on
x86_64-linux-gnu in both 32-bit and 64-bit modes.

$ clang-trunk -v
clang version 3.9.0 (trunk 261519)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
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.5
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.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Selected GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64





$ clang-trunk abc.c
abc.c:1:13: error: use of undeclared identifier 'j'
int fn1() { j = k + 2 * k; }
            ^
abc.c:1:25: error: use of undeclared identifier 'k'
int fn1() { j = k + 2 * k; }
                        ^
clang-3.9: /home/absozero/trunk/llvm/tools/clang/lib/Sema/SemaLookup.cpp:5012:
const Sema::TypoExprState &clang::Sema::getTypoExprState(clang::TypoExpr *)
const: Assertion `Entry != DelayedTypos.end() && "Failed to get the state for a
TypoExpr!"' failed.
#0 0x00000000018418e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x18418e8)
#1 0x000000000183fd96 llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x183fd96)
#2 0x0000000001841ffe SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1841ffe)
#3 0x00007fe8bec8a340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007fe8bde3ccc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fe8bde400d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fe8bde35b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fe8bde35c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000002894261 clang::Sema::getTypoExprState(clang::TypoExpr*) const
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x2894261)
#9 0x00000000027fcdc2 clang::TreeTransform<(anonymous
namespace)::TransformTypos>::TransformExpr(clang::Expr*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x27fcdc2)
#10 0x00000000027fb92f (anonymous
namespace)::TransformTypos::TryTransform(clang::Expr*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x27fb92f)
#11 0x00000000027f7ae1 clang::Sema::CorrectDelayedTyposInExpr(clang::Expr*,
clang::VarDecl*, llvm::function_ref<clang::ActionResult<clang::Expr*, true>
(clang::Expr*)>) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x27f7ae1)
#12 0x00000000023ef120
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23ef120)
#13 0x00000000023eeedd
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23eeedd)
#14 0x00000000023eeedd
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23eeedd)
#15 0x00000000023ee42b
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23ee42b)
#16 0x00000000023ee309
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23ee309)
#17 0x0000000002433df9 clang::Parser::ParseExprStatement()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x2433df9)
#18 0x0000000002432e5b
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x2432e5b)
#19 0x000000000243291b
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x243291b)
#20 0x000000000243a11a clang::Parser::ParseCompoundStatementBody(bool)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x243a11a)
#21 0x000000000243ab2c clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x243ab2c)
#22 0x00000000023aec92
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23aec92)
#23 0x00000000023c65a0 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23c65a0)
#24 0x00000000023ae2d2
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23ae2d2)
#25 0x00000000023adcb0
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23adcb0)
#26 0x00000000023acd83
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23acd83)
#27 0x00000000023ac352
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23ac352)
#28 0x00000000023a7f41 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x23a7f41)
#29 0x0000000001d28ea5 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1d28ea5)
#30 0x0000000001cf45b1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1cf45b1)
#31 0x0000000001dbd6bd
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x1dbd6bd)
#32 0x0000000000730498 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-3.9+0x730498)
#33 0x000000000072efc6 main
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x72efc6)
#34 0x00007fe8bde27ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#35 0x000000000072be55 _start
(/home/absozero/trunk/root-clang/bin/clang-3.9+0x72be55)
Stack dump:
0.    Program arguments: /home/absozero/trunk/root-clang/bin/clang-3.9 -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name abc.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
/home/absozero/trunk/root-clang/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/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
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 172 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/abc-70e4bd.o -x c abc.c
1.    abc.c:1:26: current parser token ';'
2.    abc.c:1:11: parsing function body 'fn1'
3.    abc.c:1:11: in compound statement ('{}')
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 261519)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/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/abc-9d7c86.c
clang-3.9: note: diagnostic msg: /tmp/abc-9d7c86.sh
clang-3.9: note: diagnostic msg:

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



$ cat abc.c
int fn1() { j = k + 2 * k; }

-- 
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/20160222/bc219cab/attachment-0001.html>


More information about the llvm-bugs mailing list