[LLVMbugs] [Bug 11581] New: Segmentation fault in clang-cpp when arguments are ignored
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Dec 15 00:49:58 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=11581
Bug #: 11581
Summary: Segmentation fault in clang-cpp when arguments are
ignored
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Driver
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: fjoe at samodelkin.net
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 7739
--> http://llvm.org/bugs/attachment.cgi?id=7739
Proposed fix
clang-cpp fails to preprocess empty source file when it ignores command line
arguments:
<pre>
[Dec 15 14:24:13] fjoe at husky:~/fbsd/clang$clang-cpp foo.c -lpthread
Stack dump:
0. Program arguments: clang-cpp foo.c -lpthread
1. Compilation construction
2. Building compilation actions
Segmentation fault (core dumped)
</pre>
Stack trace is:
<pre>
[Dec 15 14:24:26] fjoe at husky:~/fbsd/clang$gdb -c clang-cpp.core clang
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
warning: core file may not match specified executable file.
Core was generated by `clang-cpp'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libstdc++.so.6...done.
Loaded symbols for /usr/lib/libstdc++.so.6
Reading symbols from /lib/libm.so.5...done.
Loaded symbols for /lib/libm.so.5
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/libc.so.7...done.
Loaded symbols for /lib/libc.so.7
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0 0x000000000048679c in clang::driver::Arg::getOption (this=0x0) at Arg.h:64
64 const Option &getOption() const { return *Opt; }
(gdb) bt
#0 0x000000000048679c in clang::driver::Arg::getOption (this=0x0) at Arg.h:64
#1 0x000000000048ee0f in clang::driver::Driver::BuildActions
(this=0x7fffffffd120, TC=@0x80386e100,
Args=@0x803862300, Inputs=@0x7fffffffc480, Actions=@0x803872320)
at
/usr/fbsd/head/lib/clang/libclangdriver/../../../contrib/llvm/tools/clang/lib/Driver/Driver.cpp:1025
#2 0x0000000000492d09 in clang::driver::Driver::BuildCompilation
(this=0x7fffffffd120, ArgList=
{Data = 0x7fffffffc920, Length = 3})
at
/usr/fbsd/head/lib/clang/libclangdriver/../../../contrib/llvm/tools/clang/lib/Driver/Driver.cpp:351
#3 0x0000000000412718 in main (argc_=3, argv_=0x7fffffffd950)
at
/usr/fbsd/head/usr.bin/clang/clang/../../../contrib/llvm/tools/clang/tools/driver/driver.cpp:452
(gdb) frame 1
#1 0x000000000048ee0f in clang::driver::Driver::BuildActions
(this=0x7fffffffd120, TC=@0x80386e100,
Args=@0x803862300, Inputs=@0x7fffffffc480, Actions=@0x803872320)
at
/usr/fbsd/head/lib/clang/libclangdriver/../../../contrib/llvm/tools/clang/lib/Driver/Driver.cpp:1025
warning: Source file is more recent than executable.
1025 << FinalPhaseArg->getOption().getName();
(gdb) print FinalPhaseArg
$1 = (class clang::driver::Arg *) 0x0
(gdb)
</pre>
Patch is attached.
With the patch the output is:
<pre>
[Dec 15 15:51:43] fjoe at husky:~/fbsd/clang$clang-cpp foo.c -lpthread
clang-cpp: warning: -lpthread: 'linker' input unused
# 1 "foo.c"
# 1 "foo.c" 1
# 1 "<built-in>" 1
# 1 "<built-in>" 3
# 130 "<built-in>" 3
# 1 "<command line>" 1
# 1 "<built-in>" 2
# 1 "foo.c" 2
[Dec 15 15:51:51] fjoe at husky:~/fbsd/clang$
</pre>
--
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