[LLVMbugs] [Bug 11263] New: __has_include does not work correctly (compilation fails)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 28 19:57:55 PDT 2011


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

           Summary: __has_include does not work correctly (compilation
                    fails)
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: mimomorin at gmail.com
                CC: llvmbugs at cs.uiuc.edu


The following code fails to compile (tested on release build of trunk and
clang-3.0 rc1). 

#include <iostream>

int main (int argc, char* argv[])
{
    std::cout << __has_include(<iostream>) << std::endl;

    return 0;
}

Here is the error messages.
Assertion failed: (ParsingPreprocessorDirective && ParsingFilename == false &&
"Must be in a preprocessing directive!"), function LexIncludeFilename, file
llvm/tools/clang/lib/Lex/PreprocessorLexer.cpp, line 33.
0  clang             0x0000000105f11e22 _ZL15PrintStackTracePv + 34
1  clang             0x0000000105f12409 _ZL13SignalHandleri + 745
2  libsystem_c.dylib 0x00007fff94292cfa _sigtramp + 26
3  libsystem_c.dylib 000000000000000000 _sigtramp + 18446603338030437152
4  clang             0x0000000105f12076 abort + 22
5  clang             0x0000000105f12038 __assert_rtn + 56
6  clang             0x0000000105448ef4
clang::PreprocessorLexer::LexIncludeFilename(clang::Token&) + 164
7  clang             0x000000010543a9b2
_ZL24EvaluateHasIncludeCommonRN5clang5TokenEPNS_14IdentifierInfoERNS_12PreprocessorEPKNS_15DirectoryLookupE
+ 242
8  clang             0x0000000105437c1e
clang::Preprocessor::ExpandBuiltinMacro(clang::Token&) + 9774
9  clang             0x00000001054351e4
clang::Preprocessor::HandleMacroExpandedIdentifier(clang::Token&,
clang::MacroInfo*) + 100
10 clang             0x0000000105447933
clang::Preprocessor::HandleIdentifier(clang::Token&) + 211
11 clang             0x0000000105419fd2
clang::Lexer::LexIdentifier(clang::Token&, char const*) + 226
12 clang             0x000000010541e285
clang::Lexer::LexTokenInternal(clang::Token&) + 5829
13 clang             0x0000000105426538
clang::Preprocessor::CachingLex(clang::Token&) + 216
14 clang             0x0000000104d8bdea
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level) + 730
15 clang             0x0000000104d8badc
clang::Parser::ParseAssignmentExpression() + 188
16 clang             0x0000000104d8b9fe clang::Parser::ParseExpression() + 14
17 clang             0x0000000104dae624
clang::Parser::ParseExprStatement(clang::ParsedAttributes&) + 52
18 clang             0x0000000104dadf14
clang::Parser::ParseStatementOrDeclaration(clang::ASTOwningVector<clang::Stmt*,
32u>&, bool) + 2052
19 clang             0x0000000104db3b44
clang::Parser::ParseCompoundStatementBody(bool) + 1348
20 clang             0x0000000104db51f7
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 167
21 clang             0x0000000104dc2f62
clang::Parser::ParseFunctionDefinition(clang::Parser::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&) + 2210
22 clang             0x0000000104d74363
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1059
23 clang             0x0000000104dc2111
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 849
24 clang             0x0000000104dc2302
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 386
25 clang             0x0000000104dc12dc
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 3388
26 clang             0x0000000104dc0526
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 246
27 clang             0x0000000104d69e4d clang::ParseAST(clang::Sema&, bool) +
333
28 clang             0x0000000104d35ebc clang::CodeGenAction::ExecuteAction() +
1020
29 clang             0x0000000104b2521b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 955
30 clang             0x0000000104b0e555
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2789
31 clang             0x0000000104b0696d cc1_main(char const**, char const**,
char const*, void*) + 5421
32 clang             0x0000000104b0a811 main + 753
33 clang             0x0000000104b05434 start + 52
Stack dump:
0.    Program arguments: build/Release+Asserts/bin/clang -cc1 -triple
x86_64-apple-macosx10.7.2 -emit-obj -disable-free -main-file-name
untitled_47.cc -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables
-target-cpu core2 -target-linker-version 123.2.1 -resource-dir
build/Release+Asserts/bin/../lib/clang/3.1 -I /Users/niji/Boosty/boost-trunk -I
/Users/niji/Include -I libcxx/include -stdlib=libc++ -fmodule-cache-path
/var/folders/r5/h6yf9zwn68z4slg54d38smq80000gn/T/clang-module-cache -O3 -Wall
-fdeprecated-macro -fdebug-compilation-dir
/private/var/folders/r5/h6yf9zwn68z4slg54d38smq80000gn/T -ferror-limit 19
-fmessage-length 0 -stack-protector 1 -fblocks -fobjc-runtime-has-arc
-fobjc-runtime-has-weak -fobjc-dispatch-method=mixed -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -o
/var/folders/r5/h6yf9zwn68z4slg54d38smq80000gn/T/untitled_47-4U8F2w.o -x c++
untitled 
1.    untitled:5:31: current parser token '('
2.    untitled:4:1: parsing function body 'main'
3.    untitled:4:1: in compound statement ('{}')
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: error: unable to execute command: Illegal instruction: 4
clang: note: diagnostic msg: Error generating preprocessed source(s).

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