[cfe-dev] Clang crash in HTMLDiagnostics

Jean-Daniel Dupas devlists at shadowlab.org
Thu Aug 7 11:39:31 PDT 2008


I m' not sure, but it may be related to this (around line 1390 ~1400) :

if (!HTMLDiag.empty()) {
     // FIXME: The HTMLDiagnosticClient uses the Preprocessor for
     //  (optional) syntax highlighting, but we don't have a  
preprocessor yet.
     //  Fix this dependency later.
     DiagClient.reset(CreateHTMLDiagnosticClient(HTMLDiag, 0, 0));


Le 7 août 08 à 19:18, Nico Weber a écrit :

>> I started playing around with clang today, and hit a crash in the
>> HTMLDiagnostics. Unfortunately I don't have the time to reduce the
>> test case right now, but nevertheless I wanted to draw your attention
>> to this (maybe it's something obvious for people who know the code).
>> I'll try to come up with a testcase that relies only on open source
>> code for people to reproduce.
>
> It seems this (or at least something related) happens with any input
> file that produces a warning:
>
> Macintosh-3:clang nico$ cat test.c
> int main() {
>   char b[10] = "";
>   printf(b);
> }
> Macintosh-3:clang nico$ gdb ../../Debug/bin/clang GNU gdb
> 6.3.50-20050815 (Apple version gdb-768) (Tue Oct  2 04:07:49 UTC 2007)
> 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 "i386-apple-darwin"...Reading symbols for
> shared libraries .... done
> ^P
> (gdb) run -fsyntax-only -html-diags=/Users/nico test.c
> Starting program: /Users/nico/src/llvm-svn/Debug/bin/clang -fsyntax-
> only -html-diags=/Users/nico test.c
> Reading symbols for shared libraries +++. done
> 1 diagnostic generated.
> Assertion failed: (FileID-1 < FileIDs.size() && "Invalid FileID!"),
> function getFIDInfo, file /Users/nico/src/llvm-svn/tools/clang/
> Driver/../include/clang/Basic/SourceManager.h, line 453.
>
> Program received signal SIGABRT, Aborted.
> 0x966eeb9e in __kill ()
> (gdb) bt
> #0  0x966eeb9e in __kill ()
> #1  0x966eeb91 in kill$UNIX2003 ()
> #2  0x96765ec2 in raise ()
> #3  0x9677547f in abort ()
> #4  0x96767063 in __assert_rtn ()
> #5  0x00005422 in clang::SourceManager::getFIDInfo (this=0xd02090,
> FileID=1070333358) at SourceManager.h:453
> #6  0x00005458 in clang::SourceManager::getContentCache
> (this=0xd02090, FileID=1070333358) at SourceManager.h:458
> #7  0x0000e2e0 in clang::SourceManager::getBuffer (this=0xd02090,
> FileID=1070333358) at SourceManager.h:286
> #8  0x0000bd77 in (anonymous namespace)::HTMLDiagnostics::HandlePiece
> (this=0xd01fd0, R=@0xbffff468, BugFileID=1070333358, P=@0xd073e0,
> num=1, max=1) at HTMLDiagnostics.cpp:338
> #9  0x0000c611 in (anonymous namespace)::HTMLDiagnostics::ReportDiag
> (this=0xd01fd0, D=@0xd07310) at HTMLDiagnostics.cpp:182
> #10 0x0000d242 in (anonymous
> namespace)::HTMLDiagnostics::~HTMLDiagnostics (this=0xd01fd0) at
> HTMLDiagnostics.cpp:98
> #11 0x00030729 in std::auto_ptr<clang::DiagnosticClient>::~auto_ptr
> (this=0xbffff784) at memory:259
> #12 0x0003073d in std::auto_ptr<clang::DiagnosticClient>::~auto_ptr
> (this=0xbffff784) at memory:259
> #13 0x0002eb1e in main (argc=4, argv=0xbffff804) at clang.cpp:1515
> (gdb) The program is running.  Exit anyway? (y or n) y
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080807/2cf04885/attachment.html>


More information about the cfe-dev mailing list