Skip to content

Commit aa97bd5

Browse files
committed
[SYCL] fix null pointer crash
1 parent a86f9da commit aa97bd5

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,25 +2859,6 @@ static void handleWorkGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
28592859
WorkGroupAttr(S.Context, AL, WGSize[0], WGSize[1], WGSize[2]));
28602860
}
28612861

2862-
// Handles reqd_sub_group_size and sub_group_size.
2863-
static void handleSubGroupSize(Sema &S, Decl *D, const ParsedAttr &AL) {
2864-
if (!AL.checkExactlyNumArgs(S, 1))
2865-
return;
2866-
2867-
uint32_t WGSize[1];
2868-
Expr *E = AL.getArgAsExpr(0);
2869-
if (!S.checkUInt32Argument(AL, E, WGSize[0], 0,
2870-
/*StrictlyUnsigned=*/true))
2871-
return;
2872-
if (WGSize[0] == 0) {
2873-
S.Diag(AL.getLoc(), diag::err_attribute_argument_is_zero)
2874-
<< AL << E->getSourceRange();
2875-
return;
2876-
}
2877-
D->addAttr(::new (S.Context)
2878-
IntelReqdSubGroupSizeAttr(S.Context, AL, E));
2879-
}
2880-
28812862
static void handleVecTypeHint(Sema &S, Decl *D, const ParsedAttr &AL) {
28822863
// Given attribute is deprecated without replacement in SYCL 2020 mode.
28832864
// Ignore the attribute in SYCL 2020.
@@ -6821,10 +6802,7 @@ ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D, const ParsedAttr &AL,
68216802
break;
68226803
case ParsedAttr::AT_IntelReqdSubGroupSize:
68236804
// TODO: deprecate other spellings and change if to assert
6824-
if (S.getLangOpts().SYCLIsDevice || S.getLangOpts().SYCLIsHost)
6825-
S.SYCL().handleIntelReqdSubGroupSizeAttr(D, AL);
6826-
else
6827-
handleSubGroupSize(S, D, AL);
6805+
S.SYCL().handleIntelReqdSubGroupSizeAttr(D, AL);
68286806
break;
68296807
case ParsedAttr::AT_IntelNamedSubGroupSize:
68306808
S.SYCL().handleIntelNamedSubGroupSizeAttr(D, AL);

clang/lib/Sema/SemaSYCLDeclAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void SemaSYCL::checkDeprecatedSYCLAttributeSpelling(const ParsedAttr &A,
134134

135135
// Additionally, diagnose deprecated [[intel::reqd_sub_group_size]] spelling
136136
if (A.getKind() == ParsedAttr::AT_IntelReqdSubGroupSize &&
137-
A.getScopeName()->isStr("intel")) {
137+
A.getScopeName() && A.getScopeName()->isStr("intel")) {
138138
diagnoseDeprecatedAttribute(A, "sycl", "reqd_sub_group_size");
139139
return;
140140
}

0 commit comments

Comments
 (0)