https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105873
--- Comment #4 from Andrew Stubbs <ams at gcc dot gnu.org> --- I think unused threads should be given a no-op function to run, not a null pointer. The GCN implementation cannot tell the difference between a null pointer and an unset pointer (which is what happens when the master thread dies). There's also a potential issue of what happens when barriers occur within an active thread when there are also inactive threads. GCN barrier instructions are unconditional, meaning that all the live threads must respond. The inactive threads can do so, in a harmless way, as long as they allowed to spin, but we don't want them spinning forever when the master dies. I believe the current barrier implementation skips the barrier instruction when the team's thread count is 1. This is how we avoid issues with nested teams and tasks. I don't know why that doesn't help here?