[llvm-bugs] [Bug 24610] New: clang crashes on invalid code on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 27 22:49:03 PDT 2015


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

            Bug ID: 24610
           Summary: clang crashes on invalid code on x86_64-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk (and earlier clang versions since 3.2) crashes when
compiling the following (invalid) code in both 32-bit and 64-bit modes on
x86_64-linux-gnu. 

This is a regression from 3.1. 


$ clang-trunk -v
clang version 3.8.0 (trunk 246189)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/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.2
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.1.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.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
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.2
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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.1.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang-3.1 -O0 -c small.c
small.c:3:9: error: use of 'Color' with tag type that does not match previous
declaration
typedef struct Color C; 
        ^
small.c:1:6: note: previous use is here
enum Color { R, G, B }; 
     ^
1 error generated.
$ 
$ 
$ clang-trunk -O0 -c small.c
small.c:3:9: error: use of 'Color' with tag type that does not match previous
declaration
typedef struct Color C; 
        ^
small.c:1:6: note: previous use is here
enum Color { R, G, B }; 
     ^
clang: /tmp/llvm/tools/clang/lib/Sema/SemaDecl.cpp:3571: void
clang::Sema::setTagNameForLinkagePurposes(clang::TagDecl *,
clang::TypedefNameDecl *): Assertion
`TagFromDeclSpec->isThisDeclarationADefinition()' failed.
#0 0x2bdecad llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang+0x2bdecad)
#1 0x2bde336 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang+0x2bde336)
#2 0x2be014a (/usr/local/clang-trunk/bin/clang+0x2be014a)
#3 0x7fbe52a7d340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x7fbe51a18cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x7fbe51a1c0d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x7fbe51a11b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x7fbe51a11c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0xd012b4 clang::Sema::setTagNameForLinkagePurposes(clang::TagDecl*,
clang::TypedefNameDecl*) (/usr/local/clang-trunk/bin/clang+0xd012b4)
#9 0xd12864 clang::Sema::ParseTypedefDecl(clang::Scope*, clang::Declarator&,
clang::QualType, clang::TypeSourceInfo*)
(/usr/local/clang-trunk/bin/clang+0xd12864)
#10 0xd07bdb clang::Sema::ActOnTypedefDeclarator(clang::Scope*,
clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*,
clang::LookupResult&) (/usr/local/clang-trunk/bin/clang+0xd07bdb)
#11 0xd06430 clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&,
llvm::MutableArrayRef<clang::TemplateParameterList*>)
(/usr/local/clang-trunk/bin/clang+0xd06430)
#12 0xd05705 clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&)
(/usr/local/clang-trunk/bin/clang+0xd05705)
#13 0xbb2fa8
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang+0xbb2fa8)
#14 0xbb1621 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned
int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang+0xbb1621)
#15 0xbad117 clang::Parser::ParseSimpleDeclaration(unsigned int,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&, bool,
clang::Parser::ForRangeInit*) (/usr/local/clang-trunk/bin/clang+0xbad117)
#16 0xbacd9a clang::Parser::ParseDeclaration(unsigned int,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang+0xbacd9a)
#17 0xb97f07
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang+0xb97f07)
#18 0xb9718a
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang+0xb9718a)
#19 0xb92d26 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang+0xb92d26)
#20 0x76f5a5 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang+0x76f5a5)
#21 0x73e07c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang+0x73e07c)
#22 0x71f8e7 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang+0x71f8e7)
#23 0x715cb5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/usr/local/clang-trunk/bin/clang+0x715cb5)
#24 0x71e01c main (/usr/local/clang-trunk/bin/clang+0x71e01c)
#25 0x7fbe51a03ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#26 0x715741 _start (/usr/local/clang-trunk/bin/clang+0x715741)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -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 -target-linker-version 2.24
-dwarf-column-info -coverage-file /data2/small.c -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.8.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O0 -fdebug-compilation-dir /data2
-ferror-limit 19 -fmessage-length 123 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o small.o -x c small.c 
1.    small.c:3:23: current parser token ';'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (trunk 246189)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/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: 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/small-537306.c
clang: note: diagnostic msg: /tmp/small-537306.sh
clang: note: diagnostic msg: 

********************
$       


---------------------------


enum Color { R, G, B }; 

typedef struct Color C;

-- 
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/20150828/762e7791/attachment.html>


More information about the llvm-bugs mailing list