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 `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed. #47668

Closed
moralismercatus mannequin opened this issue Nov 28, 2020 · 2 comments
Closed
Labels
bugzilla Issues migrated from bugzilla c++17 clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]

Comments

@moralismercatus
Copy link
Mannequin

moralismercatus mannequin commented Nov 28, 2020

Bugzilla Link 48324
Version 11.0
OS Linux
Attachments .ii, .cpp, .sh and backtrace associated files.
CC @dwblaikie,@zygoloid

Extended Description

Front-end assertion while compiling dry-comparison library code.

Briefly tested code compilation godbolt.org. Clang-6 compiles. Clang versions subsequent to 6 fail with the noted assertion.

See attached files for details.

Thanks,

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
rotateright added a commit that referenced this issue Jul 1, 2022
This transform is responsible for a long-standing miscompile
as discussed in issue #47012 (was bugzilla #47668).

There was a proposal to correct it in D88432, but that was
abandoned and there hasn't been any recent activity to fix
it AFAICT.

The original patch D45108 started with a constant-shift-only
restriction and only expanded during review, so I don't think
there's much risk of perf regression on the motivating code.
@Endilll
Copy link
Contributor

Endilll commented Aug 6, 2023

Appears to be fixed on post-17 trunk: https://godbolt.org/z/Mj97b3bY4
Reduced by C-Reduce:

auto tuple = [](auto... ts) {
  return [](auto f) -> decltype(f(ts...)) {}
} auto or_elements = [](auto func) {
  return [](auto... elements) -> decltype((func(elements) || ...)) {}
};
template <typename Func, typename Tuple> struct op_t {
  Tuple tup;
  Func func;
  template <typename E> auto apply(E e) -> decltype(tup(func(e)));
  op_t(int , Func , Tuple ;
  template < typename RH > auto operator==(RH rh)  -> decltype(apply(rh));
  template < typename LH > friend auto operator==(LH lh, op_t rh) -> decltype(rh == lh)
} auto none_of = [](auto... ts) { return op_t(0, nor_elements, tuple (ts ...)
} void main() {
  0 == none_of(int{})

@Endilll Endilll closed this as completed Aug 6, 2023
@Endilll Endilll added clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid] labels Aug 6, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Aug 6, 2023

@llvm/issue-subscribers-clang-frontend

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++17 clang:frontend Language frontend issues, e.g. anything involving "Sema" crash Prefer [crash-on-valid] or [crash-on-invalid]
Projects
None yet
Development

No branches or pull requests

2 participants