[cfe-dev] SIGSEGV in call to Sema::PerformPendingInstantiations() in Clang 3.2

Tom Honermann thonermann at coverity.com
Mon May 6 15:09:54 PDT 2013

On 05/06/2013 05:38 PM, Richard Smith wrote:
> On Mon, May 6, 2013 at 2:07 PM, Tom Honermann <thonermann at coverity.com
> <mailto:thonermann at coverity.com>> wrote:
>     This email describes a SIGSEGV I'm experiencing with Clang 3.2 when
>     calling Sema::__PerformPendingInstantiations()__.  A patch against
>     latest SVN is attached which resolves the SIGSEGV.  However, it
>     appears that the call to Sema::__PerformPendingInstantiations() is
>     resulting in a call to Sema::getCurScope() which, according to its
>     comments, should never be called during template instantiation.  The
>     purpose of this email is to:
>     1) Request that the attached patch be applied to SVN.  The patch is
>     trivial - it just adds missing initialization of the Sema::CurScope
>     pointer within the Sema constructor.
> Thanks, patch committed as r181251. If you have any way of testing this
> without building an additional binary, I'd appreciate it!

I briefly tried a few different ways to tickle this gremlin, but didn't 
find a clang invocation that didn't create a Parser instance.  I'll 
admit, I didn't look hard though.

>     2) Clarify whether the eventual call into Sema::getCurScope() from
>     within Sema::__PerformPendingInstantiations() represents an
>     additional bug which should be addressed.
> Generally, yes, but getScopeForContext is always allowed to call
> getCurScope.

Excellent, thanks for the clarification!


More information about the cfe-dev mailing list