backport: re PR middle-end/58809 (ICE with complex variable in OpenMP reduction clause)

Backported from mainline
	2013-10-21  Marek Polacek  <polacek@redhat.com>

	PR middle-end/58809
	* fold-const.c (fold_range_test): Return 0 if the type is not
	an integral type.

	* gcc.dg/gomp/pr58809.c: New test.

From-SVN: r210180
This commit is contained in:
Jakub Jelinek 2014-05-07 18:11:42 +02:00 committed by Jakub Jelinek
parent 3d114c8f87
commit d66365c1fa
4 changed files with 31 additions and 3 deletions

View File

@ -1,6 +1,12 @@
2014-05-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2013-10-21 Marek Polacek <polacek@redhat.com>
PR middle-end/58809
* fold-const.c (fold_range_test): Return 0 if the type is not
an integral type.
2013-12-03 Jakub Jelinek <jakub@redhat.com>
PR middle-end/59011

View File

@ -4879,12 +4879,16 @@ fold_range_test (location_t loc, enum tree_code code, tree type,
int in0_p, in1_p, in_p;
tree low0, low1, low, high0, high1, high;
bool strict_overflow_p = false;
tree lhs = make_range (op0, &in0_p, &low0, &high0, &strict_overflow_p);
tree rhs = make_range (op1, &in1_p, &low1, &high1, &strict_overflow_p);
tree tem;
tree tem, lhs, rhs;
const char * const warnmsg = G_("assuming signed overflow does not occur "
"when simplifying range test");
if (!INTEGRAL_TYPE_P (type))
return 0;
lhs = make_range (op0, &in0_p, &low0, &high0, &strict_overflow_p);
rhs = make_range (op1, &in1_p, &low1, &high1, &strict_overflow_p);
/* If this is an OR operation, invert both sides; we will invert
again at the end. */
if (or_op)

View File

@ -1,6 +1,11 @@
2014-05-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2013-10-21 Marek Polacek <polacek@redhat.com>
PR middle-end/58809
* gcc.dg/gomp/pr58809.c: New test.
2013-12-03 Jakub Jelinek <jakub@redhat.com>
PR middle-end/59011

View File

@ -0,0 +1,13 @@
/* PR middle-end/58809 */
/* { dg-do compile } */
/* { dg-options "-fopenmp -O" } */
int i;
#pragma omp threadprivate (i)
void foo()
{
_Complex int j;
#pragma omp parallel copyin (i) reduction (&&:j)
;
}