Skip to content

Commit

Permalink
[SemaStmt] Replace check that was mistakenly removed for complicated …
Browse files Browse the repository at this point in the history
…stride calculation in a cilk_for.
  • Loading branch information
neboat committed Jan 9, 2024
1 parent aee817f commit 63b6302
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions clang/lib/Sema/SemaStmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3589,6 +3589,8 @@ StmtResult Sema::HandleSimpleCilkForStmt(SourceLocation CilkForLoc,
StrideIsNegative = StrideWithSign.second;
Stride = StrideWithSign.first;
}
if (!StrideIsUnit && !Stride)
return StmtEmpty();

// Determine the type of comparison.
//
Expand Down
11 changes: 11 additions & 0 deletions clang/test/Cilk/cilkfor-complicated-stride.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Check that Clang properly handles cilk_for loops with complicated stride
// calculations.
//
// RUN: %clang_cc1 %s -fopencilk -verify -fsyntax-only
// expected-no-diagnostics

void test(char *data, unsigned long size)
{
_Cilk_for (unsigned long i = 0; i < size; i = i + (1 << 21))
((char*) data)[i] = 0;
}

0 comments on commit 63b6302

Please sign in to comment.