[PATCH] D125349: [Sema] Fix crash for C11 atomic in gnu++ mode

Jan Svoboda via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 10 00:21:00 PDT 2022


jansvoboda11 added inline comments.


================
Comment at: clang/lib/Sema/SemaOverload.cpp:8982
 
     // Extension: Add the binary operators =, +=, -=, *=, /= for vector types.
     for (QualType Vec1Ty : CandidateTypes[0].vector_types())
----------------
jansvoboda11 wrote:
> aaron.ballman wrote:
> > Do we need to handle atomic vector types?
> I tried those, but it appears vector types don't accept `_Atomic` element types:
> 
> ```
> typedef _Atomic unsigned v_a_unsigned __attribute__((__vector_size__(16)));
> // error: invalid vector element type '_Atomic(unsigned int)'
> ```
> 
> And `_Atomic` vector gives this error:
> 
> ```
> typedef unsigned v_unsigned __attribute__((__vector_size__(16)));
> typedef _Atomic v_unsigned a_v_unsigned;
> 
> a_v_unsigned avu;
> 
> void enum5() { avu += an_enum_value; }
> void enum6() { avu |= an_enum_value; }
> ```
> 
> I'm not an expert in this area, so I can't say for sure this is the correct behavior. But at least we don't crash.
> And `_Atomic` vector gives this error:

```
error: invalid operands to binary expression
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125349/new/

https://reviews.llvm.org/D125349



More information about the cfe-commits mailing list