This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/81875] New: omp for loop optimized away
- From: "vries at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 17 Aug 2017 07:54:58 +0000
- Subject: [Bug c/81875] New: omp for loop optimized away
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81875
Bug ID: 81875
Summary: omp for loop optimized away
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: vries at gcc dot gnu.org
Target Milestone: ---
[ Redoing https://gcc.gnu.org/ml/gcc-bugs/2017-08/msg01329.html ]
Test-case from PR81805 comment 3, expanded to be runnable:
...
extern void abort (void);
#define N 32ULL
int a[N];
const unsigned long long c = 0x7fffffffffffffffULL;
void
f2_tpf_static32 (void)
{
unsigned long long i;
#pragma omp for
for (i = c + N; i > c; i -= 1ULL)
a[i - 1ULL - c] -= 4;
}
__attribute__((noinline, noclone)) int
test_tpf_static32 (void)
{
int i, j, k;
for (i = 0; i < N; i++)
a[i] = i - 25;
f2_tpf_static32 ();
for (i = 0; i < N; i++)
if (a[i] != i - 29)
return 1;
return 0;
}
int
main ()
{
if (test_tpf_static32 ())
abort ();
return 0;
}
...
Passes with fno-openmp, fails with fopenmp.
With fopenmp, the for loop is optimized away.