[LLVMbugs] [Bug 12883] New: Missed semicolon after class leads to segfault

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 18 14:21:10 PDT 2012


             Bug #: 12883
           Summary: Missed semicolon after class leads to segfault
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: rhamph+llvm at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 8593
  --> http://llvm.org/bugs/attachment.cgi?id=8593
Dat file

I've made this mistake once or twice before and gotten a poor error message,
but this time I got a crash from clang++.

My code is still relatively simple so I'm going to include both files as-is,
although it does require opengl3 and SDL1.3 headers to compile.  Let me know if
a simpler testcase is required.

yasttc.cpp:80:13: error: member 'ShaderArgs' has the same name as its class
ShaderArgs::ShaderArgs(const Buffer &vbuf, const IndexBuffer &ibuf)
yasttc.cpp:70:7: error: 'ShaderArgs' can not be defined in the result type of a 
class ShaderArgs
yasttc.cpp:80:13: error: constructor cannot have a return type                  
ShaderArgs::ShaderArgs(const Buffer &vbuf, const IndexBuffer &ibuf)
yasttc.cpp:82:24: error: invalid use of 'this' outside of a nonstatic member    
        glGenVertexArrays(1, &this->id);
yasttc.cpp:83:20: error: invalid use of 'this' outside of a nonstatic member    
yasttc.cpp:84:32: error: use of undeclared identifier 'vbuf'                    
        glBindBuffer(GL_ARRAY_BUFFER, vbuf.id);
yasttc.cpp:91:40: error: use of undeclared identifier 'ibuf'                    
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibuf.id);
yasttc.cpp:254:29: error: expected variable name or 'this' in lambda capture
        GLushort patchindexes[] = [0, 1, 2, 3];
yasttc.cpp:254:40: error: expected body of lambda expression                    
        GLushort patchindexes[] = [0, 1, 2, 3];
0  libLLVM-3.0.so.1 0x00007fcc4f888fcf                                          
1  libLLVM-3.0.so.1 0x00007fcc4f889591
2  libpthread.so.0  0x00007fcc4e812cb0
3  clang            0x0000000000a659b5
clang::Sema::UnexpandedParameterPackContext) + 21
4  clang            0x000000000089d511
clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool, bool) +
5  clang            0x00000000007f14ee
clang::Parser::ParsedTemplateInfo const&) + 1790
6  clang            0x00000000007f4c9a
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1210
7  clang            0x00000000007f9764
32u>&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, bool,
clang::Parser::ForRangeInit*) + 740
8  clang            0x00000000007f9933
clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&) + 163
9  clang            0x00000000007cf54c
32u>&, bool) + 364
10 clang            0x00000000007cca11
clang::Parser::ParseCompoundStatementBody(bool) + 417
11 clang            0x00000000007cd6fa
clang::Parser::ParseScope&) + 138
12 clang            0x00000000007e708c
clang::Parser::ParsedTemplateInfo const&) + 1116
13 clang            0x00000000007f4a42
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 610
14 clang            0x00000000007e2c75
clang::AccessSpecifier) + 149
15 clang            0x00000000007e32e6
clang::AccessSpecifier) + 678
16 clang            0x00000000007e4ead
clang::Parser::ParsingDeclSpec*) + 2685
17 clang            0x00000000007e5417
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 167
18 clang            0x00000000007bcbfd clang::ParseAST(clang::Sema&, bool) +
19 clang            0x00000000006a6253 clang::CodeGenAction::ExecuteAction() +
20 clang            0x00000000005adc7f
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 319
21 clang            0x000000000059653a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1114
22 clang            0x000000000058e1c4 cc1_main(char const**, char const**,
char const*, void*) + 820
23 clang            0x000000000058cb3c main + 620
24 libc.so.6        0x00007fcc4df5176d __libc_start_main + 237
25 clang            0x000000000058dd39
Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
yasttc.cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22 -momit-leaf-frame-pointer -resource-dir /usr/bin/../lib/clang/3.0 -D
_REENTRANT -I /home/rhamph/src/sdl/SDL-2.0/installed/include/SDL2
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/include/c++/4.6 -internal-isystem /usr/include/c++/4.6/x86_64-linux-gnu
-internal-isystem /usr/include/c++/4.6/backward -internal-isystem
/usr/local/include -internal-isystem /usr/bin/../lib/clang/3.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /usr/include -Wall -std=c++11 -fdeprecated-macro
-ferror-limit 19 -fmessage-length 81 -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/yasttc-cLARo5.o -x c++
1.      yasttc.cpp:254:40: current parser token ';'
2.      yasttc.cpp:191:30: parsing function body 'main'
3.      yasttc.cpp:191:30: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal 2 (use -v to see
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg: /tmp/yasttc-N9uZcu.ii

$ clang++ --version
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list