Issue 60943
Summary Clang: crash on recursive RETURN_CAPABILITY attribute
Labels
Assignees
Reporter klirichek
    MRE:
```C++
#define RETURN_CAPABILITY( x ) __attribute__ (( lock_returned ( x ) ))
#define REQUIRES( ... ) __attribute__ (( requires_capability ( __VA_ARGS__ ) ))

using SchedRole [[clang::capability("role")]] = bool;

class foo {
    SchedRole m_thread;
public:
    // notice - erroneously return cap getRole() instead of m_thread here.
	SchedRole getRole() const RETURN_CAPABILITY ( getRole() )
	{
		return m_thread;
	}
};

void bar (foo& a) REQUIRES(a.getRole()) {}
```

Need to be compiled with `-Wthread-safety`

Most of the versions just silently returns with code 139, however I've found one which produces readable backtrace.

https://godbolt.org/z/766v79nh1
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to