Invalid assert in lib/Sema/Lookup.h ?

classic Classic list List threaded Threaded
5 messages Options
EI
Reply | Threaded
Open this post in threaded view
|

Invalid assert in lib/Sema/Lookup.h ?

EI
Hello,

What is the meaning of this assert statement in Lookup.h?

  void setNotFoundInCurrentInstantiation() {
    assert(ResultKind == NotFound && Decls.empty());
    ResultKind = NotFoundInCurrentInstantiation;
  }

I saw assert failing when compiling some code that includes Qt headers. I think the code I was compiling was actually missing some class definitions, so I was expecting to see an error - not a failing assert. Btw, in the debugger I see that ResultKind == NotFoundInCurrentInstantiation when assert statement is reached.

Thanks,
Eugene

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invalid assert in lib/Sema/Lookup.h ?

Eli Friedman
On Mon, Aug 9, 2010 at 12:17 AM, EI <[hidden email]> wrote:

> Hello,
> What is the meaning of this assert statement in Lookup.h?
>   void setNotFoundInCurrentInstantiation() {
>     assert(ResultKind == NotFound && Decls.empty());
>     ResultKind = NotFoundInCurrentInstantiation;
>   }
> I saw assert failing when compiling some code that includes Qt headers. I
> think the code I was compiling was actually missing some class definitions,
> so I was expecting to see an error - not a failing assert. Btw, in the
> debugger I see that ResultKind == NotFoundInCurrentInstantiation when assert
> statement is reached.

It roughly means that the caller thinks nothing was found when
something actually was found.  It's hard to say more without more
information; can you provide a preprocessed file which reproduces the
issue, or at least a backtrace?

-Eli

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invalid assert in lib/Sema/Lookup.h ?

Eli Friedman
On Mon, Aug 9, 2010 at 12:34 AM, Eli Friedman <[hidden email]> wrote:

> On Mon, Aug 9, 2010 at 12:17 AM, EI <[hidden email]> wrote:
>> Hello,
>> What is the meaning of this assert statement in Lookup.h?
>>   void setNotFoundInCurrentInstantiation() {
>>     assert(ResultKind == NotFound && Decls.empty());
>>     ResultKind = NotFoundInCurrentInstantiation;
>>   }
>> I saw assert failing when compiling some code that includes Qt headers. I
>> think the code I was compiling was actually missing some class definitions,
>> so I was expecting to see an error - not a failing assert. Btw, in the
>> debugger I see that ResultKind == NotFoundInCurrentInstantiation when assert
>> statement is reached.
>
> It roughly means that the caller thinks nothing was found when
> something actually was found.  It's hard to say more without more
> information; can you provide a preprocessed file which reproduces the
> issue, or at least a backtrace?

Erm, wait, actually, what's most likely happening is that
LookupQualifiedName is getting called multiple times and failing...
random guess: does -fno-spell-checking help?

-Eli

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invalid assert in lib/Sema/Lookup.h ?

Eli Friedman
On Mon, Aug 9, 2010 at 12:42 AM, Eli Friedman <[hidden email]> wrote:

> On Mon, Aug 9, 2010 at 12:34 AM, Eli Friedman <[hidden email]> wrote:
>> On Mon, Aug 9, 2010 at 12:17 AM, EI <[hidden email]> wrote:
>>> Hello,
>>> What is the meaning of this assert statement in Lookup.h?
>>>   void setNotFoundInCurrentInstantiation() {
>>>     assert(ResultKind == NotFound && Decls.empty());
>>>     ResultKind = NotFoundInCurrentInstantiation;
>>>   }
>>> I saw assert failing when compiling some code that includes Qt headers. I
>>> think the code I was compiling was actually missing some class definitions,
>>> so I was expecting to see an error - not a failing assert. Btw, in the
>>> debugger I see that ResultKind == NotFoundInCurrentInstantiation when assert
>>> statement is reached.
>>
>> It roughly means that the caller thinks nothing was found when
>> something actually was found.  It's hard to say more without more
>> information; can you provide a preprocessed file which reproduces the
>> issue, or at least a backtrace?
>
> Erm, wait, actually, what's most likely happening is that
> LookupQualifiedName is getting called multiple times and failing...
> random guess: does -fno-spell-checking help?

Umm, actually, I just realized we already have a bug filed for this;
see http://llvm.org/bugs/show_bug.cgi?id=7625 .

-Eli

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invalid assert in lib/Sema/Lookup.h ?

Douglas Gregor

On Aug 9, 2010, at 12:53 PM, Eli Friedman wrote:

> On Mon, Aug 9, 2010 at 12:42 AM, Eli Friedman <[hidden email]> wrote:
>> On Mon, Aug 9, 2010 at 12:34 AM, Eli Friedman <[hidden email]> wrote:
>>> On Mon, Aug 9, 2010 at 12:17 AM, EI <[hidden email]> wrote:
>>>> Hello,
>>>> What is the meaning of this assert statement in Lookup.h?
>>>>   void setNotFoundInCurrentInstantiation() {
>>>>     assert(ResultKind == NotFound && Decls.empty());
>>>>     ResultKind = NotFoundInCurrentInstantiation;
>>>>   }
>>>> I saw assert failing when compiling some code that includes Qt headers. I
>>>> think the code I was compiling was actually missing some class definitions,
>>>> so I was expecting to see an error - not a failing assert. Btw, in the
>>>> debugger I see that ResultKind == NotFoundInCurrentInstantiation when assert
>>>> statement is reached.
>>>
>>> It roughly means that the caller thinks nothing was found when
>>> something actually was found.  It's hard to say more without more
>>> information; can you provide a preprocessed file which reproduces the
>>> issue, or at least a backtrace?
>>
>> Erm, wait, actually, what's most likely happening is that
>> LookupQualifiedName is getting called multiple times and failing...
>> random guess: does -fno-spell-checking help?
>
> Umm, actually, I just realized we already have a bug filed for this;
> see http://llvm.org/bugs/show_bug.cgi?id=7625 .


... which I've just fixed in Clang r110615. Please check whether this was the problem!

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev