[llvm-bugs] [Bug 26494] New: Seg fault when trying to include non-existent file

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 5 09:24:18 PST 2016


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

            Bug ID: 26494
           Summary: Seg fault when trying to include non-existent file
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: st.n at gmx.net
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

cat > bug.cc <<EOF
#include "no_such_file.h"
#include <functional>
#include <iosfwd>
namespace cmdline {
class Descr {};
void parse( int argc, char const* const* argv, Descr const* descr = 0,
            std::function<void(char const*, std::ostream&)> usage = 0 );
}
namespace foo { namespace cmdln = ::cmdline; }
int main( int argc, char** argv ) {
  foo::cmdln::Descr descr;
  parse( argc, argv, &descr );
}
EOF

clang++-3.7 -v -c bug.cc
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation:
/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3
Selected GCC installation:
/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
 "/tools/pkg/clang/3.7.0/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
bug.cc -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.25 -v
-dwarf-column-info -coverage-file /tmp/bug.cc -resource-dir
/tools/pkg/clang/3.7.0/bin/../lib/clang/3.7.0 -internal-isystem
/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3
-internal-isystem
/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/x86_64-unknown-linux-gnu
-internal-isystem
/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/backward
-internal-isystem /usr/local/include -internal-isystem
/tools/pkg/clang/3.7.0/bin/../lib/clang/3.7.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 0 -mstackrealign
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o
bug.o -x c++ bug.cc
clang -cc1 version 3.7.0 based upon LLVM 3.7.0 default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:

/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3

/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/x86_64-unknown-linux-gnu

/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/backward
 /usr/local/include
 /tools/pkg/clang/3.7.0/bin/../lib/clang/3.7.0/include
 /usr/include
End of search list.
bug.cc:1:10: fatal error: 'no_such_file.h' file not found
#include "no_such_file.h"
         ^
0  clang           0x0000000002a44305
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  clang           0x0000000002a436d1
2  libpthread.so.0 0x00007f8ed88d3130
3  clang           0x0000000000e77ffc
clang::Sema::BuildCXXDefaultArgExpr(clang::SourceLocation,
clang::FunctionDecl*, clang::ParmVarDecl*) + 1516
4  clang           0x0000000000e826fc
clang::Sema::GatherArgumentsForCall(clang::SourceLocation,
clang::FunctionDecl*, clang::FunctionProtoType const*, unsigned int,
llvm::ArrayRef<clang::Expr*>, llvm::SmallVectorImpl<clang::Expr*>&,
clang::Sema::VariadicCallType, bool, bool) + 684
5  clang           0x0000000000e83582
clang::Sema::ConvertArgumentsForCall(clang::CallExpr*, clang::Expr*,
clang::FunctionDecl*, clang::FunctionProtoType const*,
llvm::ArrayRef<clang::Expr*>, clang::SourceLocation, bool) + 2226
6  clang           0x0000000000e84723
clang::Sema::BuildResolvedCallExpr(clang::Expr*, clang::NamedDecl*,
clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::SourceLocation,
clang::Expr*, bool) + 2643
7  clang           0x0000000000fa6e93
8  clang           0x0000000000fa755e
clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*,
clang::UnresolvedLookupExpr*, clang::SourceLocation,
llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool)
+ 1022
9  clang           0x0000000000e8519a clang::Sema::ActOnCallExpr(clang::Scope*,
clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>,
clang::SourceLocation, clang::Expr*, bool) + 1754
10 clang           0x0000000000c5b6ee
clang::Parser::ParsePostfixExpressionSuffix(clang::ActionResult<clang::Expr*,
true>) + 2830
11 clang           0x0000000000c55e1b clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 107
12 clang           0x0000000000c5850d clang::Parser::ParseCastExpression(bool,
bool, clang::Parser::TypeCastState) + 29
13 clang           0x0000000000c5858f
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 31
14 clang           0x0000000000c58609
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 9
15 clang           0x0000000000c99416 clang::Parser::ParseExprStatement() + 54
16 clang           0x0000000000c9875f
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 3183
17 clang           0x0000000000c988b4
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 116
18 clang           0x0000000000c956ae
clang::Parser::ParseCompoundStatementBody(bool) + 1710
19 clang           0x0000000000c9d00e
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 190
20 clang           0x0000000000c22bbe
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
1214
21 clang           0x0000000000c3bcb0
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2592
22 clang           0x0000000000c1ec41
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 273
23 clang           0x0000000000c1f289
24 clang           0x0000000000c1f2bf
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 31
25 clang           0x0000000000c252df
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 255
26 clang           0x0000000000c25ad0
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 384
27 clang           0x0000000000c1a703 clang::ParseAST(clang::Sema&, bool, bool)
+ 275
28 clang           0x000000000087854e clang::FrontendAction::Execute() + 254
29 clang           0x0000000000852f49
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 297
30 clang           0x000000000083ab93
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1923
31 clang           0x0000000000833620 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 2576
32 clang           0x00000000007fb1d6 main + 10422
33 libc.so.6       0x00007f8ed78d4af5 __libc_start_main + 245
34 clang           0x0000000000832541
Stack dump:
0.    Program arguments: /tools/pkg/clang/3.7.0/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name bug.cc -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.25 -v -dwarf-column-info -coverage-file /tmp/bug.cc
-resource-dir /tools/pkg/clang/3.7.0/bin/../lib/clang/3.7.0 -internal-isystem
/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3
-internal-isystem
/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/x86_64-unknown-linux-gnu
-internal-isystem
/tools/pkg/gcc/4.9.3/lib/gcc/x86_64-unknown-linux-gnu/4.9.3/../../../../include/c++/4.9.3/backward
-internal-isystem /usr/local/include -internal-isystem
/tools/pkg/clang/3.7.0/bin/../lib/clang/3.7.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 0 -mstackrealign
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o
bug.o -x c++ bug.cc 
1.    bug.cc:12:29: current parser token ')'
2.    bug.cc:10:35: parsing function body 'main'
3.    bug.cc:10:35: in compound statement ('{}')
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
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: Error generating preprocessed source(s).

-- 
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/20160205/754196e4/attachment.html>


More information about the llvm-bugs mailing list