[all-commits] [llvm/llvm-project] e732d1: [Clang] Fix ICE in SemaOpenMP with structured bind...

Yuxuan Chen via All-commits all-commits at lists.llvm.org
Mon Aug 19 14:06:31 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e732d1ce86783b1d7fe30645fcb30434109505b9
      https://github.com/llvm/llvm-project/commit/e732d1ce86783b1d7fe30645fcb30434109505b9
  Author: Yuxuan Chen <ych at fb.com>
  Date:   2024-08-19 (Mon, 19 Aug 2024)

  Changed paths:
    M clang/lib/Sema/SemaOpenMP.cpp
    A clang/test/SemaOpenMP/gh104810.cpp

  Log Message:
  -----------
  [Clang] Fix ICE in SemaOpenMP with structured binding (#104822)

Fixes https://github.com/llvm/llvm-project/issues/104810.

Clang currently crashes on the following program:
```
struct S {
  int i;
};

auto [a] = S{1};

void foo() {
    a;
}
```
when `-fopenmp` is enabled. 

Because `a` is neither `VarDecl` nor `FieldDecl`. It's a `BindingDecl`
that's not handled in `SemaOpenMP.cpp`'s `getCanonicalDecl`. It appears
to me that this pattern matching is merely just for a refined return
type of the overrides. It can also be achieved with just using the
virtual `Decl::getCanonicalDecl()` instead. Do the final casting should
be safe for `ValueDecl`s.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list