summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2017-09-16 13:11:43 +0000
committerTom de Vries <vries@gcc.gnu.org>2017-09-16 13:11:43 +0000
commitebc6a85e3e8dc9a3e02301a6f9e2216781af565a (patch)
tree888bb213198ee08c5156289bb7ed91cf22bbfbcc /libgomp
parenta1b99efd4b868cfb5583454cd3d70d54fdafbc33 (diff)
downloadgcc-ebc6a85e3e8dc9a3e02301a6f9e2216781af565a.tar.gz
Fix condition folding in c_parser_omp_for_loop
2017-09-16 Tom de Vries <tom@codesourcery.com> PR c/81875 * c-parser.c (c_parser_omp_for_loop): Fold only operands of cond, not cond itself. * testsuite/libgomp.c-c++-common/pr81875.c: New test. From-SVN: r252873
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog5
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/pr81875.c46
2 files changed, 51 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 9fafd622b60..0c8832cf097 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-16 Tom de Vries <tom@codesourcery.com>
+
+ PR c/81875
+ * testsuite/libgomp.c-c++-common/pr81875.c: New test.
+
2017-09-14 Tom de Vries <tom@codesourcery.com>
* testsuite/libgomp.c++/cancel-taskgroup-1.C: Remove.
diff --git a/libgomp/testsuite/libgomp.c-c++-common/pr81875.c b/libgomp/testsuite/libgomp.c-c++-common/pr81875.c
new file mode 100644
index 00000000000..3067d49a492
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/pr81875.c
@@ -0,0 +1,46 @@
+/* { dg-do run } */
+
+extern
+#ifdef __cplusplus
+"C"
+#endif
+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;
+}