Skip to content

Commit

Permalink
[Clang][Sema] Fix invalid cast when validating SVE types within Check…
Browse files Browse the repository at this point in the history
…VariableDeclarationType.

Fixes #62087

Differential Revision: https://reviews.llvm.org/D148919
  • Loading branch information
paulwalker-arm committed Apr 24, 2023
1 parent 593e25f commit 2bb7e00
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8705,7 +8705,7 @@ void Sema::CheckVariableDeclarationType(VarDecl *NewVD) {
}

// Check that SVE types are only used in functions with SVE available.
if (T->isSVESizelessBuiltinType() && CurContext->isFunctionOrMethod()) {
if (T->isSVESizelessBuiltinType() && isa<FunctionDecl>(CurContext)) {
const FunctionDecl *FD = cast<FunctionDecl>(CurContext);
llvm::StringMap<bool> CallerFeatureMap;
Context.getFunctionFeatureMap(CallerFeatureMap, FD);
Expand Down
11 changes: 11 additions & 0 deletions clang/test/SemaOpenMP/arm-sve-acle-types.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: %clang_cc1 -fopenmp -fsyntax-only -triple aarch64-arm-none-eabi -target-feature +sve -verify %s
// expected-no-diagnostics

__SVBool_t foo(int);

void test() {
#pragma omp parallel
{
__SVBool_t pg = foo(1);
}
}

0 comments on commit 2bb7e00

Please sign in to comment.