From ba009860aec4619f2424f5bdee812f14572dc3cc Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 18 Nov 2020 09:40:45 +0100 Subject: openmp: Fix ICE on non-rectangular loop with known 0 iterations The loops in the testcase are non-rectangular and have 0 iterations (the outer loop iterates, but the inner one never). In this case we just have the overall number of iterations computed (0), and don't have factor and other values computed. We never need to map logical iterations to the individual iterations in that case, and we were crashing during expansion of that code. 2020-11-18 Jakub Jelinek PR middle-end/97862 * omp-expand.c (expand_omp_for_init_vars): Don't use the sqrt path if number of iterations is constant 0. * c-c++-common/gomp/pr97862.c: New test. --- gcc/testsuite/c-c++-common/gomp/pr97862.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 gcc/testsuite/c-c++-common/gomp/pr97862.c (limited to 'gcc/testsuite') diff --git a/gcc/testsuite/c-c++-common/gomp/pr97862.c b/gcc/testsuite/c-c++-common/gomp/pr97862.c new file mode 100644 index 0000000..21aad3f --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr97862.c @@ -0,0 +1,15 @@ +/* PR middle-end/97862 */ + +void +foo (void) +{ + int i, j; +#pragma omp for collapse(2) + for (i = 0; i < 1; ++i) + for (j = 0; j < i; ++j) + ; +#pragma omp for collapse(2) + for (i = 0; i < 20; i++) + for (j = 0; j < i - 19; j += 1) + ; +} -- cgit v1.1