[LLVMbugs] [Bug 12579] New: Clang crashes compiling inline class method with loop. (only in Release mode)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 17 13:05:45 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12579

             Bug #: 12579
           Summary: Clang crashes compiling inline class method with loop.
                    (only in Release mode)
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: victor at bogado.net
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 8402
  --> http://llvm.org/bugs/attachment.cgi?id=8402
Class.cpp file that trigered the bug.

The problem is the following : 

$ Release+Asserts/bin/clang++ -cc1 -triple x86_64-unknown-linux-gnu -emit-obj
-mrelax-all -disable-free -main-file-name Class.cpp -pic-level 2
-mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -target-linker-version 2.17.50.0.6 -momit-leaf-frame-pointer
-g -coverage-file CMakeFiles/SigeosdkCore.dir/src/Class.cpp.o -resource-dir
/g0dv/Bin/RHEL5_64/clang/bin/../lib/clang/3.1 -isystem
/g0eo/Bin/LinuxE5_64/DevTools/IteratorTypeErasure -isystem
/g0eo/Bin/LinuxE5_64/DevTools/boost_1_48 -D SigeosdkCore_EXPORTS -D
QT_NO_KEYWORDS -D BOOST_FILESYSTEM_VERSION=3 -D VERSION_SigeosdkCore -D
VERSION_TestImplPlugin -D VERSION_DepTestPlugin -I
/u/y2fx/coisas_do_sigeo3g/SigeosdkCore/build_clang -I
/g0eo/Bin/LinuxE5_64/DevTools/cxxtest -I
/u/y2fx/coisas_do_sigeo3g/SigeosdkCore/src -I
/g0eo/Bin/LinuxE5_64/DevTools/gtest/include -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/../../../../include/c++/4.4.4
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/../../../../include/c++/4.4.4/x86_64-redhat-linux6E
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/../../../../include/c++/4.4.4/backward
-internal-isystem /usr/local/include -internal-isystem
/g0dv/Bin/RHEL5_64/clang/bin/../lib/clang/3.1/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -Wall -Werror -Wextra
-Wno-mismatched-tags -Wno-unused-function -Wno-error=deprecated
-Wno-error=parentheses -Wno-error=sign-compare -Wno-error=unused-parameter
-Wno-deprecated-writable-strings -Wno-char-subscripts
-Wno-error=covered-switch-default -Wno-error=overloaded-virtual
-Wno-error=switch -Wno-error=delete-non-virtual-dtor
-Wno-error=ignored-qualifiers -fdeprecated-macro -fdebug-compilation-dir
/u/y2fx/coisas_do_sigeo3g/SigeosdkCore/build_clang -ferror-limit 19
-fmessage-length 153 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o Class.cpp.o -x c++
$HOME/teste/class.cpp

0  clang++         0x0000000001dab32f
1  clang++         0x0000000001dab819
2  libpthread.so.0 0x0000003253e0eb70
3  clang++         0x0000000000e0d202
4  clang++         0x0000000000e0e6c1
5  clang++         0x0000000000e1090b
clang::runUninitializedVariablesAnalysis(clang::DeclContext const&, clang::CFG
const&, clang::AnalysisDeclContext&, clang::UninitVariablesHandler&,
clang::UninitVariablesAnalysisStats&) + 1515
6  clang++         0x0000000000c0b89e
clang::sema::AnalysisBasedWarnings::IssueWarnings(clang::sema::AnalysisBasedWarnings::Policy,
clang::sema::FunctionScopeInfo*, clang::Decl const*, clang::BlockExpr const*) +
1198
7  clang++         0x000000000094c750
clang::Sema::PopFunctionScopeInfo(clang::sema::AnalysisBasedWarnings::Policy
const*, clang::Decl const*, clang::BlockExpr const*) + 320
8  clang++         0x00000000009dbb23
clang::Sema::ActOnFinishFunctionBody(clang::Decl*, clang::Stmt*, bool) + 499
9  clang++         0x000000000092a921
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 193
10 clang++         0x0000000000938eb2
clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) + 674
11 clang++         0x0000000000938b90
clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) + 160
12 clang++         0x00000000008f329c
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, unsigned int,
clang::Decl*) + 3196
13 clang++         0x00000000008f41e3
clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext) + 2995
14 clang++         0x00000000008e0d69
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext,
llvm::SmallVector<clang::Parser::LateParsedAttribute*, 2u>*) + 2105
15 clang++         0x00000000008cf78c
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 92
16 clang++         0x00000000008cfda6
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 790
17 clang++         0x00000000008d4144
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 2036
18 clang++         0x00000000008d430f
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 191
19 clang++         0x00000000008cd10d clang::ParseAST(clang::Sema&, bool, bool)
+ 285
20 clang++         0x000000000078c724 clang::CodeGenAction::ExecuteAction() +
68
21 clang++         0x0000000000644341
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 337
22 clang++         0x000000000062b1ca
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1098
23 clang++         0x000000000062199d cc1_main(char const**, char const**, char
const*, void*) + 8973
24 clang++         0x0000000000629f82 main + 7634
25 libc.so.6       0x000000325321d994 __libc_start_main + 244
26 clang++         0x000000000061ea99
Stack dump:
0.      Program arguments: ./build_g0dv/Release+Asserts/bin/clang++ -cc1
-triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name Class.cpp -pic-level 2 -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.17.50.0.6 -momit-leaf-frame-pointer -g -coverage-file
CMakeFiles/SigeosdkCore.dir/src/Class.cpp.o -resource-dir
/g0dv/Bin/RHEL5_64/clang/bin/../lib/clang/3.1 -isystem
/g0eo/Bin/LinuxE5_64/DevTools/IteratorTypeErasure -isystem
/g0eo/Bin/LinuxE5_64/DevTools/boost_1_48 -D SigeosdkCore_EXPORTS -D
QT_NO_KEYWORDS -D BOOST_FILESYSTEM_VERSION=3 -D VERSION_SigeosdkCore -D
VERSION_TestImplPlugin -D VERSION_DepTestPlugin -I
/u/y2fx/coisas_do_sigeo3g/SigeosdkCore/build_clang -I
/g0eo/Bin/LinuxE5_64/DevTools/cxxtest -I
/u/y2fx/coisas_do_sigeo3g/SigeosdkCore/src -I
/g0eo/Bin/LinuxE5_64/DevTools/gtest/include -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/../../../../include/c++/4.4.4
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/../../../../include/c++/4.4.4/x86_64-redhat-linux6E
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/../../../../include/c++/4.4.4/backward
-internal-isystem /usr/local/include -internal-isystem
/g0dv/Bin/RHEL5_64/clang/bin/../lib/clang/3.1/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -Wall -Werror -Wextra
-Wno-mismatched-tags -Wno-unused-function -Wno-error=deprecated
-Wno-error=parentheses -Wno-error=sign-compare -Wno-error=unused-parameter
-Wno-deprecated-writable-strings -Wno-char-subscripts
-Wno-error=covered-switch-default -Wno-error=overloaded-virtual
-Wno-error=switch -Wno-error=delete-non-virtual-dtor
-Wno-error=ignored-qualifiers -fdeprecated-macro -fdebug-compilation-dir
/u/y2fx/coisas_do_sigeo3g/SigeosdkCore/build_clang -ferror-limit 19
-fmessage-length 153 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -o Class.cpp.o -x c++
/u/y2fx/teste/class.cpp 
1.      /u/y2fx/teste/class.cpp:24:2: current parser token ';'
2.      /u/y2fx/teste/class.cpp:3:1: parsing struct/union/class body 'Class'
3.      /u/y2fx/teste/class.cpp:7:2: parsing function body 'isA'
Segmentation fault

$

It only happens with clang compiled with optimization. Even though I compiled
using the gcc 4.7 and with the following configure command line : 

$ CXX=/g0dv/Bin/LinuxE5_64/gcc47/bin/g++ CC=/g0dv/Bin/LinuxE5_64/gcc47/bin/gcc 
../configure --prefix=/g0dv/Bin/LinuxE5_64/clang/
--with-cxx-include-root=/g0dv/Bin/LinuxE5_64/gcc47/include/c++/4.7.0/
--with-cxx-include-arch=x86_64-unknown-linux-gnu/
--with-cxx-include-32bit-dir=32 --with-cxx-include-64bit-dir=
--with-extra-ld-options=-Wl,-rpath,/g0dv/Bin/LinuxE5_64/gcc47/lib64/
CXX=/g0dv/Bin/LinuxE5_64/gcc47/bin/g++47

gcc47 here is the official release from gnu.

the problematic 'class.cpp' is attached.

-- 
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