[clang] ef066db - [Clang] Fix crash on comparisons of `_BitInt` vectors wider than 128 bits (#232797)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 4 08:46:51 PST 2026
Author: Akash Manna
Date: 2026-11-04T17:46:44+01:00
New Revision: ef066dbbf4a04aa6919732e884826f73b4cb5bec
URL: https://github.com/llvm/llvm-project/commit/ef066dbbf4a04aa6919732e884826f73b4cb5bec
DIFF: https://github.com/llvm/llvm-project/commit/ef066dbbf4a04aa6919732e884826f73b4cb5bec.diff
LOG: [Clang] Fix crash on comparisons of `_BitInt` vectors wider than 128 bits (#232797)
Fixes #200665
`Sema::GetSignedVectorType` picks the element type for the result of a
vector comparison by matching the element's size against `char`,
`short`, `int`, `__int128`, `long` and `long long`, and asserts when
nothing matches. Since `_BitInt` became a legal vector element in Clang
16, any `_BitInt` wider than 128 bits falls off the end of that chain:
`a > 0` on a `_BitInt(512)` vector trips the assertion, and a release
build hands back a `long long` vector instead. The malformed input in
the report is incidental; a plain `v3i512 f(v3i512 a) { return a > 0; }`
crashes the same way.
The `_BitInt` case is now handled where the asserts used to fire: after
the builtin size checks, a `_BitInt` element with no builtin counterpart
produces the signed `_BitInt` of the same width, in the same vector kind
and with the same element count. Widths that match a builtin integer
keep mapping to it exactly as before, so nothing changes for `_BitInt`
up to 128 bits.
AI assisted.
Added:
clang/test/SemaCXX/ext-int-vector.cpp
Modified:
clang/docs/ReleaseNotes.md
clang/lib/Sema/SemaExpr.cpp
clang/test/CodeGenCXX/ext-int.cpp
clang/test/Sema/ext-int.c
Removed:
################################################################################
diff --git a/clang/docs/ReleaseNotes.md b/clang/docs/ReleaseNotes.md
index 83248f68f539e..56668c4feda01 100644
--- a/clang/docs/ReleaseNotes.md
+++ b/clang/docs/ReleaseNotes.md
@@ -835,6 +835,7 @@ documentation](CIR/index.md) for more information regarding ClangIR's status and
- Fixed an ICE hat occurred when using `__imag int/float` as lvalue in assignment. (#GH119498)
- Fixed a C23 rejects-valid where `auto T x;` (with `T` a typedef-name) was rejected as a missing initializer. (#GH164930)
- Fixed an assertion failure in `-Wsign-compare` when a negated or complemented vector of unsigned integers was compared against a signed constant. (#GH203575)
+- Fixed a crash when comparing vectors of `_BitInt` wider than 128 bits. (#GH200665)
- Fixed an assertion failure when a constant statement expression that declares a variable is used as a bound of an OpenMP loop. A statement expression in a bound of a non-rectangular loop is now diagnosed. (#GH153987)
- Fixed a bug where a bit-field accessed as the result of a statement expression
(e.g. `({ s.b; })`) was not subject to integer promotion, unlike an ordinary
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index a14c3d50d1285..02b496da880c7 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -13715,9 +13715,13 @@ QualType Sema::GetSignedVectorType(QualType V) {
return Context.getExtVectorType(Context.Int128Ty, VTy->getNumElements());
if (TypeSize == Context.getTypeSize(Context.LongTy))
return Context.getExtVectorType(Context.LongTy, VTy->getNumElements());
- assert(TypeSize == Context.getTypeSize(Context.LongLongTy) &&
- "Unhandled vector element size in vector compare");
- return Context.getExtVectorType(Context.LongLongTy, VTy->getNumElements());
+ if (TypeSize == Context.getTypeSize(Context.LongLongTy))
+ return Context.getExtVectorType(Context.LongLongTy,
+ VTy->getNumElements());
+ const auto *BIT = VTy->getElementType()->castAs<BitIntType>();
+ return Context.getExtVectorType(
+ Context.getBitIntType(/*IsUnsigned=*/false, BIT->getNumBits()),
+ VTy->getNumElements());
}
if (TypeSize == Context.getTypeSize(Context.Int128Ty))
@@ -13735,10 +13739,13 @@ QualType Sema::GetSignedVectorType(QualType V) {
if (TypeSize == Context.getTypeSize(Context.ShortTy))
return Context.getVectorType(Context.ShortTy, VTy->getNumElements(),
VectorKind::Generic);
- assert(TypeSize == Context.getTypeSize(Context.CharTy) &&
- "Unhandled vector element size in vector compare");
- return Context.getVectorType(Context.CharTy, VTy->getNumElements(),
- VectorKind::Generic);
+ if (TypeSize == Context.getTypeSize(Context.CharTy))
+ return Context.getVectorType(Context.CharTy, VTy->getNumElements(),
+ VectorKind::Generic);
+ const auto *BIT = VTy->getElementType()->castAs<BitIntType>();
+ return Context.getVectorType(
+ Context.getBitIntType(/*IsUnsigned=*/false, BIT->getNumBits()),
+ VTy->getNumElements(), VectorKind::Generic);
}
QualType Sema::GetSignedSizelessVectorType(QualType V) {
diff --git a/clang/test/CodeGenCXX/ext-int.cpp b/clang/test/CodeGenCXX/ext-int.cpp
index 95e81dd47d33f..d08788d111e9e 100644
--- a/clang/test/CodeGenCXX/ext-int.cpp
+++ b/clang/test/CodeGenCXX/ext-int.cpp
@@ -618,6 +618,50 @@ uint2_t2 TestBitIntVector2x2Alloca(uint2_t2 v1, uint2_t2 v2) {
return v1 + v2;
}
+typedef _BitInt(512) vint512_t3 __attribute__((ext_vector_type(3)));
+typedef _BitInt(256) vint256_t2 __attribute__((vector_size(64)));
+typedef unsigned _BitInt(256) uvint256_t2 __attribute__((vector_size(64)));
+
+vint512_t3 VectorCompareGTZero(vint512_t3 a) {
+ // CHECK: %[[CMP:.+]] = icmp sgt <3 x i512> %{{.+}}, zeroinitializer
+ // CHECK: %[[SEXT:.+]] = sext <3 x i1> %[[CMP]] to <3 x i512>
+ return a > 0;
+}
+
+vint256_t2 VectorCompareEQ(vint256_t2 a, vint256_t2 b) {
+ // CHECK: %[[CMP:.+]] = icmp eq <2 x i256> %{{.+}}, %{{.+}}
+ // CHECK: %[[SEXT:.+]] = sext <2 x i1> %[[CMP]] to <2 x i256>
+ return a == b;
+}
+
+vint256_t2 VectorCompareULT(uvint256_t2 a, uvint256_t2 b) {
+ // CHECK: %[[CMP:.+]] = icmp ult <2 x i256> %{{.+}}, %{{.+}}
+ // CHECK: %[[SEXT:.+]] = sext <2 x i1> %[[CMP]] to <2 x i256>
+ return a < b;
+}
+
+vint512_t3 VectorLogicalNot(vint512_t3 a) {
+ // CHECK: %[[CMP:.+]] = icmp eq <3 x i512> %{{.+}}, zeroinitializer
+ // CHECK: %[[SEXT:.+]] = sext <3 x i1> %[[CMP]] to <3 x i512>
+ return !a;
+}
+
+vint256_t2 VectorLogicalAnd(vint256_t2 a, vint256_t2 b) {
+ // CHECK: %[[LHS:.+]] = icmp ne <2 x i256> %{{.+}}, zeroinitializer
+ // CHECK: %[[RHS:.+]] = icmp ne <2 x i256> %{{.+}}, zeroinitializer
+ // CHECK: %[[AND:.+]] = and <2 x i1> %[[LHS]], %[[RHS]]
+ // CHECK: %[[SEXT:.+]] = sext <2 x i1> %[[AND]] to <2 x i256>
+ return a && b;
+}
+
+vint512_t3 VectorSelect(vint512_t3 a, vint512_t3 b, vint512_t3 c) {
+ // CHECK: %[[CMP:.+]] = icmp slt <3 x i512> %{{.+}}, zeroinitializer
+ // CHECK: %[[SEXT:.+]] = sext <3 x i1> %[[CMP]] to <3 x i512>
+ // CHECK: %[[COND:.+]] = icmp slt <3 x i512> %[[SEXT]], zeroinitializer
+ // CHECK: select <3 x i1> %[[COND]], <3 x i512> %{{.+}}, <3 x i512> %{{.+}}
+ return a < 0 ? b : c;
+}
+
// Ensure that these types don't alias the normal int types.
void TBAATest(_BitInt(sizeof(int) * 8) ExtInt,
unsigned _BitInt(sizeof(int) * 8) ExtUInt,
diff --git a/clang/test/Sema/ext-int.c b/clang/test/Sema/ext-int.c
index ebc5bc61260b4..3e61d784b885e 100644
--- a/clang/test/Sema/ext-int.c
+++ b/clang/test/Sema/ext-int.c
@@ -73,3 +73,82 @@ void FromPaper1(void) {
void FromPaper2(_BitInt(8) a1, _BitInt(24) a2) {
_Static_assert(EXPR_HAS_TYPE(a1 * (_BitInt(32))a2, _BitInt(32)), "");
}
+
+typedef _BitInt(4) ExtVec4x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(8) ExtVec8x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(32) ExtVec32x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(128) ExtVec128x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(256) ExtVec256x2 __attribute__((ext_vector_type(2)));
+typedef _BitInt(512) ExtVec512x3 __attribute__((ext_vector_type(3)));
+typedef _BitInt(1024) ExtVec1024x2 __attribute__((ext_vector_type(2)));
+typedef unsigned _BitInt(512) ExtUVec512x3 __attribute__((ext_vector_type(3)));
+typedef _BitInt(8) GnuVec8x4 __attribute__((vector_size(4)));
+typedef _BitInt(64) GnuVec64x4 __attribute__((vector_size(32)));
+typedef _BitInt(256) GnuVec256x2 __attribute__((vector_size(64)));
+typedef _BitInt(1024) GnuVec1024x2 __attribute__((vector_size(256)));
+typedef unsigned _BitInt(256) GnuUVec256x2 __attribute__((vector_size(64)));
+typedef unsigned __int128 UInt128Ext4 __attribute__((ext_vector_type(4)));
+typedef unsigned __int128 UInt128Gnu2 __attribute__((vector_size(32)));
+typedef __fp16 HalfExt4 __attribute__((ext_vector_type(4)));
+typedef float FloatExt4 __attribute__((ext_vector_type(4)));
+typedef long double LongDoubleExt4 __attribute__((ext_vector_type(4)));
+typedef double DoubleGnu4 __attribute__((vector_size(32)));
+typedef char CharExt4 __attribute__((ext_vector_type(4)));
+typedef short ShortExt4 __attribute__((ext_vector_type(4)));
+typedef int IntExt4 __attribute__((ext_vector_type(4)));
+typedef __int128 Int128Ext4 __attribute__((ext_vector_type(4)));
+typedef char CharGnu4 __attribute__((vector_size(4)));
+typedef long long LongLongGnu4 __attribute__((vector_size(32)));
+typedef __int128 Int128Gnu2 __attribute__((vector_size(32)));
+
+void GH200665(ExtVec4x4 e4a, ExtVec4x4 e4b, ExtVec8x4 e8a, ExtVec8x4 e8b,
+ ExtVec32x4 e32a, ExtVec32x4 e32b, ExtVec128x4 e128a,
+ ExtVec128x4 e128b, ExtVec256x2 e256a, ExtVec256x2 e256b,
+ ExtVec512x3 e512a, ExtVec512x3 e512b, ExtVec1024x2 e1024a,
+ ExtVec1024x2 e1024b, ExtUVec512x3 eu512a, ExtUVec512x3 eu512b,
+ GnuVec8x4 g8a, GnuVec8x4 g8b, GnuVec64x4 g64a, GnuVec64x4 g64b,
+ GnuVec256x2 g256a, GnuVec256x2 g256b, GnuVec1024x2 g1024a,
+ GnuVec1024x2 g1024b, GnuUVec256x2 gu256a, GnuUVec256x2 gu256b) {
+ _Static_assert(EXPR_HAS_TYPE(e4a == e4b, CharExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(e8a != e8b, CharExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(e32a < e32b, IntExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(e128a <= e128b, Int128Ext4), "");
+ _Static_assert(EXPR_HAS_TYPE(e256a > e256b, ExtVec256x2), "");
+ _Static_assert(EXPR_HAS_TYPE(e512a >= e512b, ExtVec512x3), "");
+ _Static_assert(EXPR_HAS_TYPE(e512a > 0, ExtVec512x3), "");
+ _Static_assert(EXPR_HAS_TYPE(0 == e1024a, ExtVec1024x2), "");
+ _Static_assert(EXPR_HAS_TYPE(e1024a != e1024b, ExtVec1024x2), "");
+ _Static_assert(EXPR_HAS_TYPE(eu512a == eu512b, ExtVec512x3), "");
+ _Static_assert(EXPR_HAS_TYPE(!e4a, CharExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(!e512a, ExtVec512x3), "");
+ _Static_assert(EXPR_HAS_TYPE(!eu512a, ExtVec512x3), "");
+ _Static_assert(EXPR_HAS_TYPE(e512a && e512b, ExtVec512x3), "");
+ _Static_assert(EXPR_HAS_TYPE(e4a || e4b, CharExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(e512a ? e512a : e512b, ExtVec512x3), "");
+ _Static_assert(EXPR_HAS_TYPE((e512a > 0) ? e512a : e512b, ExtVec512x3), "");
+ _Static_assert(EXPR_HAS_TYPE((eu512a == eu512b) ? eu512a : eu512b, ExtUVec512x3), "");
+
+ _Static_assert(EXPR_HAS_TYPE(g8a == g8b, CharGnu4), "");
+ _Static_assert(EXPR_HAS_TYPE(g64a < g64b, LongLongGnu4), "");
+ _Static_assert(EXPR_HAS_TYPE(g256a > g256b, GnuVec256x2), "");
+ _Static_assert(EXPR_HAS_TYPE(g256a >= 0, GnuVec256x2), "");
+ _Static_assert(EXPR_HAS_TYPE(g1024a != g1024b, GnuVec1024x2), "");
+ _Static_assert(EXPR_HAS_TYPE(gu256a <= gu256b, GnuVec256x2), "");
+}
+
+void OtherElementTypes(UInt128Ext4 u128a, UInt128Ext4 u128b, UInt128Gnu2 gu128a,
+ UInt128Gnu2 gu128b, HalfExt4 ha, HalfExt4 hb, FloatExt4 fa,
+ FloatExt4 fb, LongDoubleExt4 lda, LongDoubleExt4 ldb,
+ DoubleGnu4 da, DoubleGnu4 db) {
+ _Static_assert(EXPR_HAS_TYPE(u128a == u128b, Int128Ext4), "");
+ _Static_assert(EXPR_HAS_TYPE(gu128a < gu128b, Int128Gnu2), "");
+ _Static_assert(EXPR_HAS_TYPE(ha == hb, ShortExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(!ha, ShortExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(fa < fb, IntExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(fa > 0, IntExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(!fa, IntExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(fa && fb, IntExt4), "");
+ _Static_assert(EXPR_HAS_TYPE((fa < fb) ? fa : fb, FloatExt4), "");
+ _Static_assert(EXPR_HAS_TYPE(lda >= ldb, Int128Ext4), "");
+ _Static_assert(EXPR_HAS_TYPE(da != db, LongLongGnu4), "");
+}
diff --git a/clang/test/SemaCXX/ext-int-vector.cpp b/clang/test/SemaCXX/ext-int-vector.cpp
new file mode 100644
index 0000000000000..cdef72b389100
--- /dev/null
+++ b/clang/test/SemaCXX/ext-int-vector.cpp
@@ -0,0 +1,125 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-linux-gnu %s
+
+namespace GH200665 {
+typedef _BitInt(2) ExtVec2x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(4) ExtVec4x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(8) ExtVec8x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(16) ExtVec16x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(32) ExtVec32x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(64) ExtVec64x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(128) ExtVec128x4 __attribute__((ext_vector_type(4)));
+typedef _BitInt(256) ExtVec256x2 __attribute__((ext_vector_type(2)));
+typedef _BitInt(512) ExtVec512x3 __attribute__((ext_vector_type(3)));
+typedef _BitInt(1024) ExtVec1024x2 __attribute__((ext_vector_type(2)));
+typedef unsigned _BitInt(4) ExtUVec4x4 __attribute__((ext_vector_type(4)));
+typedef unsigned _BitInt(128) ExtUVec128x4 __attribute__((ext_vector_type(4)));
+typedef unsigned _BitInt(512) ExtUVec512x3 __attribute__((ext_vector_type(3)));
+typedef unsigned __int128 UInt128Ext4 __attribute__((ext_vector_type(4)));
+typedef __fp16 HalfExt4 __attribute__((ext_vector_type(4)));
+typedef _Float16 Float16Ext4 __attribute__((ext_vector_type(4)));
+typedef float FloatExt4 __attribute__((ext_vector_type(4)));
+typedef double DoubleExt4 __attribute__((ext_vector_type(4)));
+typedef long double LongDoubleExt4 __attribute__((ext_vector_type(4)));
+typedef char CharExt4 __attribute__((ext_vector_type(4)));
+typedef short ShortExt4 __attribute__((ext_vector_type(4)));
+typedef int IntExt4 __attribute__((ext_vector_type(4)));
+typedef long LongExt4 __attribute__((ext_vector_type(4)));
+typedef __int128 Int128Ext4 __attribute__((ext_vector_type(4)));
+
+typedef _BitInt(4) GnuVec4x2 __attribute__((vector_size(2)));
+typedef _BitInt(8) GnuVec8x4 __attribute__((vector_size(4)));
+typedef _BitInt(16) GnuVec16x4 __attribute__((vector_size(8)));
+typedef _BitInt(32) GnuVec32x4 __attribute__((vector_size(16)));
+typedef _BitInt(64) GnuVec64x4 __attribute__((vector_size(32)));
+typedef _BitInt(128) GnuVec128x2 __attribute__((vector_size(32)));
+typedef _BitInt(256) GnuVec256x2 __attribute__((vector_size(64)));
+typedef _BitInt(512) GnuVec512x2 __attribute__((vector_size(128)));
+typedef _BitInt(1024) GnuVec1024x2 __attribute__((vector_size(256)));
+typedef unsigned _BitInt(256) GnuUVec256x2 __attribute__((vector_size(64)));
+typedef unsigned __int128 UInt128Gnu2 __attribute__((vector_size(32)));
+typedef __fp16 HalfGnu4 __attribute__((vector_size(8)));
+typedef _Float16 Float16Gnu4 __attribute__((vector_size(8)));
+typedef float FloatGnu4 __attribute__((vector_size(16)));
+typedef double DoubleGnu4 __attribute__((vector_size(32)));
+typedef long double LongDoubleGnu2 __attribute__((vector_size(32)));
+typedef char CharGnu2 __attribute__((vector_size(2)));
+typedef char CharGnu4 __attribute__((vector_size(4)));
+typedef short ShortGnu4 __attribute__((vector_size(8)));
+typedef int IntGnu4 __attribute__((vector_size(16)));
+typedef long long LongLongGnu4 __attribute__((vector_size(32)));
+typedef __int128 Int128Gnu2 __attribute__((vector_size(32)));
+
+template <typename V, typename R> void check(V a, V b) {
+ static_assert(__is_same(decltype(a == b), R), "");
+ static_assert(__is_same(decltype(a != b), R), "");
+ static_assert(__is_same(decltype(a < b), R), "");
+ static_assert(__is_same(decltype(a <= b), R), "");
+ static_assert(__is_same(decltype(a > b), R), "");
+ static_assert(__is_same(decltype(a >= b), R), "");
+ static_assert(__is_same(decltype(a > 0), R), "");
+ static_assert(__is_same(decltype(0 < a), R), "");
+ static_assert(__is_same(decltype(!a), R), "");
+ static_assert(__is_same(decltype(a && b), R), "");
+ static_assert(__is_same(decltype(a || b), R), "");
+ static_assert(__is_same(decltype((a < b) ? a : b), V), "");
+ static_assert(__is_same(decltype(!a ? b : a), V), "");
+}
+
+template <typename V, typename R> void check_int(V a, V b) {
+ check<V, R>(a, b);
+ static_assert(__is_same(decltype(a ? a : b), V), "");
+}
+
+template void check_int<ExtVec2x4, CharExt4>(ExtVec2x4, ExtVec2x4);
+template void check_int<ExtVec4x4, CharExt4>(ExtVec4x4, ExtVec4x4);
+template void check_int<ExtVec8x4, CharExt4>(ExtVec8x4, ExtVec8x4);
+template void check_int<ExtVec16x4, ShortExt4>(ExtVec16x4, ExtVec16x4);
+template void check_int<ExtVec32x4, IntExt4>(ExtVec32x4, ExtVec32x4);
+template void check_int<ExtVec64x4, LongExt4>(ExtVec64x4, ExtVec64x4);
+template void check_int<ExtVec128x4, Int128Ext4>(ExtVec128x4, ExtVec128x4);
+template void check_int<ExtVec256x2, ExtVec256x2>(ExtVec256x2, ExtVec256x2);
+template void check_int<ExtVec512x3, ExtVec512x3>(ExtVec512x3, ExtVec512x3);
+template void check_int<ExtVec1024x2, ExtVec1024x2>(ExtVec1024x2, ExtVec1024x2);
+template void check_int<ExtUVec4x4, CharExt4>(ExtUVec4x4, ExtUVec4x4);
+template void check_int<ExtUVec128x4, Int128Ext4>(ExtUVec128x4, ExtUVec128x4);
+template void check_int<ExtUVec512x3, ExtVec512x3>(ExtUVec512x3, ExtUVec512x3);
+template void check_int<UInt128Ext4, Int128Ext4>(UInt128Ext4, UInt128Ext4);
+template void check<HalfExt4, ShortExt4>(HalfExt4, HalfExt4);
+template void check<Float16Ext4, ShortExt4>(Float16Ext4, Float16Ext4);
+template void check<FloatExt4, IntExt4>(FloatExt4, FloatExt4);
+template void check<DoubleExt4, LongExt4>(DoubleExt4, DoubleExt4);
+template void check<LongDoubleExt4, Int128Ext4>(LongDoubleExt4, LongDoubleExt4);
+
+template void check_int<GnuVec4x2, CharGnu2>(GnuVec4x2, GnuVec4x2);
+template void check_int<GnuVec8x4, CharGnu4>(GnuVec8x4, GnuVec8x4);
+template void check_int<GnuVec16x4, ShortGnu4>(GnuVec16x4, GnuVec16x4);
+template void check_int<GnuVec32x4, IntGnu4>(GnuVec32x4, GnuVec32x4);
+template void check_int<GnuVec64x4, LongLongGnu4>(GnuVec64x4, GnuVec64x4);
+template void check_int<GnuVec128x2, Int128Gnu2>(GnuVec128x2, GnuVec128x2);
+template void check_int<GnuVec256x2, GnuVec256x2>(GnuVec256x2, GnuVec256x2);
+template void check_int<GnuVec512x2, GnuVec512x2>(GnuVec512x2, GnuVec512x2);
+template void check_int<GnuVec1024x2, GnuVec1024x2>(GnuVec1024x2, GnuVec1024x2);
+template void check_int<GnuUVec256x2, GnuVec256x2>(GnuUVec256x2, GnuUVec256x2);
+template void check_int<UInt128Gnu2, Int128Gnu2>(UInt128Gnu2, UInt128Gnu2);
+template void check<HalfGnu4, ShortGnu4>(HalfGnu4, HalfGnu4);
+template void check<Float16Gnu4, ShortGnu4>(Float16Gnu4, Float16Gnu4);
+template void check<FloatGnu4, IntGnu4>(FloatGnu4, FloatGnu4);
+template void check<DoubleGnu4, LongLongGnu4>(DoubleGnu4, DoubleGnu4);
+template void check<LongDoubleGnu2, Int128Gnu2>(LongDoubleGnu2, LongDoubleGnu2);
+
+// expected-error at +1{{'_BitInt' vector element width must be a power of 2}}
+typedef _BitInt(7) __attribute__((ext_vector_type(4))) ExtVec7x4;
+// expected-error at +1{{'_BitInt' vector element width must be a power of 2}}
+typedef _BitInt(255) __attribute__((ext_vector_type(2))) ExtVec255x2;
+// expected-error at +1{{'_BitInt' vector element width must be a power of 2}}
+typedef _BitInt(255) __attribute__((vector_size(64))) GnuVec255x2;
+} // namespace GH200665
+
+// Original reproducer of GH200665.
+// expected-error at +1{{expected ')'}}
+using i512x3 = _BitInt(512) __attribute__((ext_vector_type(3));
+// expected-note at -1{{'i512x3' declared here}}
+// expected-error at +3{{unknown type name 'v3i512x3'; did you mean 'i512x3'?}}
+// expected-warning at +2{{variable 'a' is uninitialized when used within its own initialization}}
+// expected-error at +1{{expected ';' after top level declarator}}
+v3i512x3 a {a>0}
More information about the cfe-commits
mailing list