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
This commit is contained in:
parent
a1b99efd4b
commit
ebc6a85e3e
4 changed files with 65 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
||||
2017-09-15 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
PR c/82071
|
||||
|
|
|
@ -15224,7 +15224,14 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code,
|
|||
|
||||
cond = cond_expr.value;
|
||||
cond = c_objc_common_truthvalue_conversion (cond_loc, cond);
|
||||
cond = c_fully_fold (cond, false, NULL);
|
||||
if (COMPARISON_CLASS_P (cond))
|
||||
{
|
||||
tree op0 = TREE_OPERAND (cond, 0), op1 = TREE_OPERAND (cond, 1);
|
||||
op0 = c_fully_fold (op0, false, NULL);
|
||||
op1 = c_fully_fold (op1, false, NULL);
|
||||
TREE_OPERAND (cond, 0) = op0;
|
||||
TREE_OPERAND (cond, 1) = op1;
|
||||
}
|
||||
switch (cond_expr.original_code)
|
||||
{
|
||||
case GT_EXPR:
|
||||
|
|
|
@ -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.
|
||||
|
|
46
libgomp/testsuite/libgomp.c-c++-common/pr81875.c
Normal file
46
libgomp/testsuite/libgomp.c-c++-common/pr81875.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Add table
Reference in a new issue