[cfe-dev] Clang crash in HTMLDiagnostics

Kay Röpke kay at mysql.com
Thu Aug 7 05:19:55 PDT 2008


Hi!

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.

Stacktrace and gdb info:
$ gdb clang
(gdb) run -html-diags=/tmp/html-diag  -pedantic -DHAVE_CONFIG_H -I=.. - 
I=/opt/local/include/glib-2.0 -I=/opt/local/include -I=/opt/local/lib/ 
glib-2.0/include -I=/opt/mysql/include/mysql chassis.c
349 diagnostics generated.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0xc033c4fb
0x001ee9f9 in clang::SourceManager::getColumnNumber (this=0xc02080,  
Loc={ID = 19692785}) at SourceManager.cpp:177
177	  while (LineStart && Buf[LineStart-1] != '\n' &&  
Buf[LineStart-1] != '\r')
(gdb) bt
#0  0x001ee9f9 in clang::SourceManager::getColumnNumber  
(this=0xc02080, Loc={ID = 19692785}) at SourceManager.cpp:177
#1  0x001ee223 in clang::FullSourceLoc::getColumnNumber  
(this=0xbfffe650) at SourceLocation.cpp:58
#2  0x0000b937 in (anonymous namespace)::HTMLDiagnostics::HandlePiece  
(this=0xc00550, R=@0xbfffeaa8, BugFileID=150, P=@0xe504e0, num=1,  
max=1) at HTMLDiagnostics.cpp:344
#3  0x0000c281 in (anonymous namespace)::HTMLDiagnostics::ReportDiag  
(this=0xc00550, D=@0xe50470) at HTMLDiagnostics.cpp:182
#4  0x0000ceb2 in (anonymous  
namespace)::HTMLDiagnostics::~HTMLDiagnostics (this=0xc00550) at  
HTMLDiagnostics.cpp:98
#5  0x000300eb in std::auto_ptr<clang::DiagnosticClient>::~auto_ptr  
(this=0xbfffeda4) at memory:259
#6  0x0002f012 in main (argc=10, argv=0xbfffee24) at clang.cpp:1515
(gdb) p LineStart
$1 = 31985
(gdb) p Buf
$2 = 0xc033480b <Address 0xc033480b out of bounds>

If you need more information or want me to try patches etc, please let  
me know.
Both LLVM and clang are built from a fresh checkout of trunk:

classdump:clang kroepke$ svn info
Last Changed Author: kremenek
Last Changed Rev: 54440
Last Changed Date: 2008-08-07 03:02:05 +0200 (Thu, 07 Aug 2008)

classdump:clang kroepke$ cd ../..
classdump:llvm-svn kroepke$ svn info
Last Changed Author: asl
Last Changed Rev: 54461
Last Changed Date: 2008-08-07 11:55:25 +0200 (Thu, 07 Aug 2008)

cheers,
-k

p.s.: (duh, stupid address autocompletion - sent it to cfe-dev-request  
originally :P)

-- 
Kay Roepke
Software Engineer, MySQL Enterprise Tools

Sun Microsystems GmbH    Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfang Engels, Dr. Roland Boemer
Vorsitz d. Aufs.rat.: Martin Haering                    HRB MUC 161028



More information about the cfe-dev mailing list