[LLVMbugs] [Bug 12924] New: SEGV when linking with -x c++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 23 09:27:08 PDT 2012


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

             Bug #: 12924
           Summary: SEGV when linking with -x c++
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jed at 59a2.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ cat hello.c
#include <stdio.h>

int main(int argc, char *argv[])
{
  puts("hello");
  return 0;
}
$ clang++ --version && clang++ -x c++ hello.c
clang version 3.1 (branches/release_31)
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ clang++ -x c++ -c hello.c && clang++ -x c++ hello.o
clang version 3.1 (branches/release_31)
Target: x86_64-unknown-linux-gnu
Thread model: posix
hello.o:1:1: error: expected unqualified-id
0  libLLVM-3.1.so  0x00007f18a04390df
1  libLLVM-3.1.so  0x00007f18a0439549
2  libpthread.so.0 0x00007f189f777140
3  clang           0x000000000062e8ec
clang::TextDiagnostic::emitSnippetAndCaret(clang::SourceLocation,
clang::DiagnosticsEngine::Level,
llvm::SmallVectorImpl<clang::CharSourceRange>&,
llvm::ArrayRef<clang::FixItHint>) + 2524
4  clang           0x0000000000625852
clang::DiagnosticRenderer::emitMacroExpansionsAndCarets(clang::SourceLocation,
clang::DiagnosticsEngine::Level,
llvm::SmallVectorImpl<clang::CharSourceRange>&,
llvm::ArrayRef<clang::FixItHint>, unsigned int&, unsigned int) + 82
5  clang           0x00000000006253b9
clang::DiagnosticRenderer::emitDiagnostic(clang::SourceLocation,
clang::DiagnosticsEngine::Level, llvm::StringRef,
llvm::ArrayRef<clang::CharSourceRange>, llvm::ArrayRef<clang::FixItHint>,
llvm::PointerUnion<clang::Diagnostic const*, clang::StoredDiagnostic const*>) +
697
6  clang           0x0000000000618a4c
clang::TextDiagnosticPrinter::HandleDiagnostic(clang::DiagnosticsEngine::Level,
clang::Diagnostic const&) + 1100
7  clang           0x0000000000f37a21
clang::DiagnosticIDs::ProcessDiag(clang::DiagnosticsEngine&) const + 385
8  clang           0x0000000000f32354
clang::DiagnosticsEngine::EmitCurrentDiagnostic() + 20
9  clang           0x00000000005ccf0c
10 clang           0x0000000000842d5e
clang::Parser::ParseDirectDeclarator(clang::Declarator&) + 798
11 clang           0x000000000083a5ba
clang::Parser::ParseDeclaratorInternal(clang::Declarator&, void
(clang::Parser::*)(clang::Declarator&)) + 218
12 clang           0x000000000083ac62
clang::Parser::ParseDeclarator(clang::Declarator&) + 18
13 clang           0x000000000083acd8
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 104
14 clang           0x000000000082d4b8
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 152
15 clang           0x000000000082dbd5
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 773
16 clang           0x000000000082fcff
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 3247
17 clang           0x000000000082ffff
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 191
18 clang           0x00000000008282ed clang::ParseAST(clang::Sema&, bool, bool)
+ 285
19 clang           0x00000000005d7206
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 262
20 clang           0x00000000005c0552
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1042
21 clang           0x00000000005b9b73 cc1_main(char const**, char const**, char
const*, void*) + 9091
22 clang           0x00000000005b6c91 main + 7009
23 libc.so.6       0x00007f189eecf455 __libc_start_main + 245
24 clang           0x00000000005b766d
Stack dump:
0.      Program arguments: /usr/bin/clang -cc1 -triple x86_64-unknown-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
hello.o -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22.0.20120323 -momit-leaf-frame-pointer -resource-dir
/usr/bin/../lib/clang/3.1 -fmodule-cache-path /var/tmp/clang-module-cache
-internal-isystem
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0
-internal-isystem
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/x86_64-unknown-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.1/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/jed/lang/c -ferror-limit 19 -fmessage-length 239
-mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-fragile-abi -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/hello-xkwyMG.o -x c++ hello.o 
1.      hello.o:1:1: current parser token ''
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: 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: Segmentation fault (core dumped)
clang: note: diagnostic msg: Error generating preprocessed source(s).

$ ~/usr/llvm/bin/clang++ --version && ~/usr/llvm/bin/clang++ -x c++ hello.c
clang version 3.2 
Target: x86_64-unknown-linux-gnu
Thread model: posix
$ ~/usr/llvm/bin/clang++ -x c++ -c hello.c && ~/usr/llvm/bin/clang++ -x c++
hello.o                                                                         
hello.o:1:1: error: expected unqualified-id
<U+007F>ELF<U+0002><U+0001><U+0001><U+0003>
^
hello.o:1:9: warning: null character ignored [-Wnull-character]
<U+007F>ELF<U+0002><U+0001><U+0001><U+0003>
                                           ^
[...]
hello.o:1:87: warning: null character ignored [-Wnull-character]
  ...<U+0000>  <U+0000>UH<89><E5>H<83><EC>
H<8D><U+0004>%<U+0000><U+0000><U+0000><U+0000><C7>E<FC><U+0000><U+0000><U+0000>
                                                                               
                                          ^
hello.o:1:89: error: extraneous closing brace ('}')
  ...<U+0000>  <U+0000>UH<89><E5>H<83><EC>
H<8D><U+0004>%<U+0000><U+0000><U+0000><U+0000><C7>E<FC><U+0000><U+0000><U+0000><U+0000><89>}<F8>H<89>u<F0>H<89><C7><E8>
                                                                               
                                                      ^
hello.o:1:90: error: expected unqualified-id
clang-3.2: /home/jed/src/llvm/tools/clang/lib/Frontend/TextDiagnostic.cpp:257:
int SourceColumnMap::byteToColumn(int) const: Assertion `0<=n &&
n<static_cast<int>(m_byteToColumn.size())' failed.
Stack dump:
0.      Program arguments: /home/jed/usr/llvm/bin/clang-3.2 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
hello.o -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64
-momit-leaf-frame-pointer -resource-dir /home/jed/usr/llvm/bin/../lib/clang/3.2
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0
-internal-isystem
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/x86_64-unknown-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/jed/usr/llvm/bin/../lib/clang/3.2/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /home/jed/lang/c -ferror-limit 19 -fmessage-length 239
-mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-fragile-abi -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/hello-LtW4ia.o -x c++ hello.o 
1.      hello.o:1:90: current parser token 'ΓΈ'
clang-3: error: unable to execute command: Aborted (core dumped)
clang-3: error: clang frontend command failed due to signal (use -v to see
invocation)
clang-3: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang-3: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang-3: note: diagnostic msg: /tmp/hello-0i0UFf.ii
clang-3: note: diagnostic msg: /tmp/hello-0i0UFf.sh

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