<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Clang crashes when compiling source on FreeBSD but not on Mac OSX"
href="http://llvm.org/bugs/show_bug.cgi?id=22684">22684</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Clang crashes when compiling source on FreeBSD but not on Mac OSX
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.4
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>FreeBSD
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>hbowden@securelabsllc.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=13940" name="attach_13940" title="The .i file">attachment 13940</a> <a href="attachment.cgi?id=13940&action=edit" title="The .i file">[details]</a></span>
The .i file
When trying to compile a smallish c project on FreeBSD 10.1, clang crashes.
Looking at the clang output it appears clang is having problems with a file
called entryGetfsstat.c more specifically the line ".syscallNumber = 18,". This
should have been removed by me because it's no longer in use and there is no
member in that struct named syscallNumber anymore. Removing this line stops
clang from crashing. But that should have been a simple compilation error
instead of crashing the whole compiler. Below I included some output from clang
and what arguments I passed to clang. I also attached the .i file for
entryGetfsstat.c that I believe is causing the crash. Here is a link to a
coredump for clang if you want/need.
<a href="https://mega.co.nz/#!Ml0CALAC!G75nLD1j6zj55nggT862sIbIHWlP5X-P19B0jbTbifE">https://mega.co.nz/#!Ml0CALAC!G75nLD1j6zj55nggT862sIbIHWlP5X-P19B0jbTbifE</a>
If you need anything else let me know, thanks.
Here is the struct clang is having trouble with, and just for clarification
removing the line ".syscallNumber = 18," stops the crash.
struct syscallEntry entryGetfsstat = {
.entryNumber = 14,
.syscallNumber = 18,
.nameOfSyscall = (char *)"getfsstat",
.numberOfArgs = 3,
.argNameIndex[0] = (char *)"path",
.argTypeIndex[0] = ARG_FILE_DESC,
.argNameIndex[1] = (char *)"uid",
.argTypeIndex[1] = ARG_UID_T,
.argNameIndex[2] = (char *)"gid",
.argTypeIndex[2] = ARG_GID_T,
.callSyscall = &callGetfsstat,
.logSyscall = &logGetfsstat,
};
Here's what was passed to clang.
-DFREEBSD -o systemFuzzer arguments.c context.c fuzzer.c zmalloc.c log.c
getTable.c child.c generateArgs.c object.c socketServer.c syscall.c signals.c
maps.c systemFuzzer.c utils.c parser.c main.c fuzzers/fuzzTypes.c
fuzzers/fuzzDescriptor.c fuzzers/fuzzSocket.c fuzzers/fuzzFlags.c
fuzzers/fuzzPointers.c fuzzers/fuzzBuffer.c fuzzers/fuzzFilePaths.c
fuzzers/fuzzSignals.c fuzzers/fuzzUtils.c entries/Common/entryRead.c
entries/Common/entryWrite.c entries/Common/entryOpen.c
entries/Common/entryClose.c entries/Common/entryWait4.c
entries/Common/entryLink.c entries/Common/entryUnlink.c
entries/Common/entryChdir.c entries/Common/entryFchdir.c
entries/Common/entryMknod.c entries/FreeBSD/entryGetfsstat.c
/usr/local/lib/libcrypto.a -lpthread -Ientries/FreeBSD/ -Wall -Werror
-Weverything -Wno-deprecated-declarations -g -fstack-protector-all -O2
-Wno-newline-eof -Wno-padded -Wno-format-nonliteral
-Wno-missing-variable-declarations -Wno-unused-parameter -Wno-pointer-arith
And here's some of clangs output.
Stack dump:
0. Program arguments: /usr/bin/clang -cc1 -triple x86_64-unknown-freebsd10.1
-S -disable-free -disable-llvm-verifier -main-file-name entryGetfsstat.c
-mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases
-munwind-tables -target-cpu x86-64 -gdwarf-2 -resource-dir
/usr/bin/../lib/clang/3.4.1 -O2 -Wall -Werror -Weverything
-Wno-deprecated-declarations -Wno-newline-eof -Wno-padded
-Wno-format-nonliteral -Wno-missing-variable-declarations -Wno-unused-parameter
-Wno-pointer-arith -fconst-strings -fdebug-compilation-dir
/usr/home/web/systemFuzzer -ferror-limit 19 -fmessage-length 82
-stack-protector 2 -mstackrealign -fobjc-runtime=gnustep
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o entryGetfsstat.s -x cpp-output entryGetfsstat.i
1. entries/FreeBSD/entryGetfsstat.c:63:2: 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)
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.1
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.freebsd.org/submit/">https://bugs.freebsd.org/submit/</a> and include the crash backtrace, preprocessed
source, and associated run script.
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: note: diagnostic msg: Error generating preprocessed source(s).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>