summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/parallel_for_collapse_messages.cpp
diff options
context:
space:
mode:
authorJoel E. Denny <jdenny.ornl@gmail.com>2019-04-23 17:04:15 +0000
committerJoel E. Denny <jdenny.ornl@gmail.com>2019-04-23 17:04:15 +0000
commit3234887fe2ea94d5997b4ba9999401459a29905b (patch)
tree843fa6636935b50c1cf5a6871a8b19fefc91332e /clang/test/OpenMP/parallel_for_collapse_messages.cpp
parentbdb864a5762e10a485c0b76c5677f5c14b4045d7 (diff)
downloadbcm5719-llvm-3234887fe2ea94d5997b4ba9999401459a29905b.tar.gz
bcm5719-llvm-3234887fe2ea94d5997b4ba9999401459a29905b.zip
[APSInt][OpenMP] Fix isNegative, etc. for unsigned types
Without this patch, APSInt inherits APInt::isNegative, which merely checks the sign bit without regard to whether the type is actually signed. isNonNegative and isStrictlyPositive call isNegative and so are also affected. This patch adjusts APSInt to override isNegative, isNonNegative, and isStrictlyPositive with implementations that consider whether the type is signed. A large set of Clang OpenMP tests are affected. Without this patch, these tests assume that `true` is not a valid argument for clauses like `collapse`. Indeed, `true` fails APInt::isStrictlyPositive but not APSInt::isStrictlyPositive. This patch adjusts those tests to assume `true` should be accepted. This patch also adds tests revealing various other similar fixes due to APSInt::isNegative calls in Clang's ExprConstant.cpp and SemaExpr.cpp: `++` and `--` overflow in `constexpr`, evaluated object size based on `alloc_size`, `<<` and `>>` shift count validation, and OpenMP array section validation. Reviewed By: lebedev.ri, ABataev, hfinkel Differential Revision: https://reviews.llvm.org/D59712 llvm-svn: 359012
Diffstat (limited to 'clang/test/OpenMP/parallel_for_collapse_messages.cpp')
-rw-r--r--clang/test/OpenMP/parallel_for_collapse_messages.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/test/OpenMP/parallel_for_collapse_messages.cpp b/clang/test/OpenMP/parallel_for_collapse_messages.cpp
index 9d99c25efa6..192fa45c904 100644
--- a/clang/test/OpenMP/parallel_for_collapse_messages.cpp
+++ b/clang/test/OpenMP/parallel_for_collapse_messages.cpp
@@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}}
#pragma omp parallel for collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}}
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp parallel for', but found only 1}}
// expected-error@+6 2 {{directive '#pragma omp parallel for' cannot contain more than one 'collapse' clause}}
- // expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}}
+ // expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}}
// expected-error@+4 2 {{expression is not an integral constant expression}}
#if __cplusplus >= 201103L
// expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}}
@@ -86,7 +86,7 @@ int main(int argc, char **argv) {
// expected-note@+4{{non-constexpr function 'foobool' cannot be used in a constant expression}}
#endif
// expected-error@+2 2 {{directive '#pragma omp parallel for' cannot contain more than one 'collapse' clause}}
- // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}}
+ // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}}
#pragma omp parallel for collapse (foobool(argc)), collapse (true), collapse (-5)
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
#pragma omp parallel for collapse (S1) // expected-error {{'S1' does not refer to a value}}
OpenPOWER on IntegriCloud