[cfe-dev] core dump, how to best investigate

Jeroen Ruigrok van der Werven asmodai at in-nomine.org
Tue Jul 24 06:40:00 PDT 2007


-On [20070724 14:04], Jeroen Ruigrok van der Werven (asmodai at in-nomine.org) wrote:
>#1  0x081d94d7 in clang::Sema::ParseUnaryOp (this=0x831b880, OpLoc=
>      {ID = 2148130816}, Op=clang::tok::kw___extension__, input=0x0)
>    at SemaExpr.cpp:1455
>#2  0x081f7c40 in clang::Parser::ParseCastExpression (this=0x831b800,
>    isUnaryExpression=false) at ParseExpr.cpp:546

So ParseUnaryOp() has an input which is empty and as such resultType =
Input->getType(); fails.

ParseCastExpression() is executing:
Res = Actions.ParseUnaryOp(SavedLoc, SavedKind, Res.Val);

which has to mean that Res.Val is empty:

(gdb) print Res.Val
$1 = (void *) 0x0

It seems to come from including unistd.h on FreeBSD, which includes
sys/types.h, which includes machine/endian.h which results in:

[15:37] [asmodai at nexus] (1125) {0} % clang /usr/include/machine/endian.h
/usr/include/machine/endian.h:146:10: warning: expression result unused
        return (__byte_swap_int(_x));
                ^~~~~~~~~~~~~~~
zsh: segmentation fault (core dumped)  clang /usr/include/machine/endian.h

Relevant part of the source file:

#define __byte_swap_int_var(x) \
__extension__ ({ register __uint32_t __X = (x); \
   __asm ("bswap %0" : "+r" (__X)); \
   __X; })

And looking at Parse/ParseExpr.cpp line 542 this seems expected:

// FIXME: Extension not handled correctly here!

-- 
Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/
To give your sheep or cow a large spacious meadow is the way to control him...



More information about the cfe-dev mailing list