Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failed: !NodePtr->isKnownSentinel() with boost::intrusive_ptr on Windows #44378

Closed
atnnn mannequin opened this issue Feb 26, 2020 · 4 comments
Closed

Assertion failed: !NodePtr->isKnownSentinel() with boost::intrusive_ptr on Windows #44378

atnnn mannequin opened this issue Feb 26, 2020 · 4 comments
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@atnnn
Copy link
Mannequin

atnnn mannequin commented Feb 26, 2020

Bugzilla Link 45033
Resolution FIXED
Resolved on Mar 02, 2020 02:43
Version trunk
OS Windows NT
Blocks #43900
Attachments Minimal example, Build log, Run script
CC @DougGregor,@zmodem,@zygoloid,@rnk

Extended Description

The following code seems to cause clang and clang-cl, 9.0.0 and trunk, to crash:

intrusive_ptr<C> a;
try {
    a = mk();
    mk();
}
catch (...) {
}

Debug logs show

INSTCOMBINE ITERATION #&#8203;1 on ?crash@@YAXXZ
IC: ADDING: 27 instrs to worklist
IC: Visiting:   %call1 = invoke %struct.C* @"?mk@@YAPEAUC@@XZ"()
          to label %invoke.cont2 unwind label %catch.dispatch
IC: Visiting:   %a.sroa.0.0 = phi i64 [ %0, %invoke.cont2 ], [ 0, %entry ]
IC: Visiting:   %1 = catchswitch within none [label %catch] unwind label %ehcleanup
IC: Visiting:   %2 = catchpad within %1 [i8* null, i32 64, i8* null]
IC: Visiting:   catchret from %2 to label %try.cont
IC: Visiting:   %a.sroa.0.1 = phi i64 [ %0, %invoke.cont2 ], [ %a.sroa.0.0, %catch ]
IC: ADD:   %a.sroa.0.1.ptr = phi %struct.C* 
Assertion failed: !NodePtr->isKnownSentinel(), file C:\src\llvm_package_2663a25f\llvm-project\llvm\include\llvm/ADT/ilist_iterator.h, line 139

I've attached the logs and full trimmed down source.

Thanks.

@rnk
Copy link
Collaborator

rnk commented Feb 28, 2020

I suspect the problematic code was introduced here (2017):
https://reviews.llvm.org/D37832#inline-686315

It assumes getFirstInsertionPt always points to an Instruction*, and not an end iterator.

@rnk
Copy link
Collaborator

rnk commented Feb 28, 2020

Proposed fix: https://reviews.llvm.org/D75381

@rnk
Copy link
Collaborator

rnk commented Mar 1, 2020

Pushed as 1adbe86.

Marked as a 10.0 blocker to see if Hans wants to merge it. I think it's fairly safe, it adds some conditions in which instcombine will not attempt to do a transform.

@zmodem
Copy link
Collaborator

zmodem commented Mar 2, 2020

Pushed as 1adbe86.

Marked as a 10.0 blocker to see if Hans wants to merge it. I think it's
fairly safe, it adds some conditions in which instcombine will not attempt
to do a transform.

Okay, it seems safe enough. Pushed to 10.x as 0bf4795.

Please let me know if there are any follow-ups.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++
Projects
None yet
Development

No branches or pull requests

2 participants