From: Jakub Jelinek Date: Sat, 27 May 2017 07:46:12 +0000 (+0200) Subject: re PR bootstrap/80887 (gnat bootstrap fails at s-regpat.o: raised STORAGE_ERROR ... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=56a35ac922195c920f075ae544d6f1a90ae71b83;p=gcc.git re PR bootstrap/80887 (gnat bootstrap fails at s-regpat.o: raised STORAGE_ERROR : stack overflow or erroneous memory access) PR bootstrap/80887 2017-05-25 Marc Glisse * match.pd ((A +- CST1) +- CST2): Allow some conversions. * gcc.dg/tree-ssa/addadd.c: Xfail all scan-tree-dump*. From-SVN: r248533 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ca02b51bdd7..c79553c6120 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-05-27 Jakub Jelinek + + PR bootstrap/80887 + 2017-05-25 Marc Glisse + + * match.pd ((A +- CST1) +- CST2): Allow some conversions. + 2017-05-26 Martin Liska * dumpfile.h (enum dump_kind): Renumber TDF_* flags to be contiguous. diff --git a/gcc/match.pd b/gcc/match.pd index b5e5a98770e..54a8e0449f8 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1299,39 +1299,15 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) /* (A +- CST1) +- CST2 -> A + CST3 */ (for outer_op (plus minus) (for inner_op (plus minus) - neg_inner_op (minus plus) (simplify - (outer_op (convert? (inner_op @0 CONSTANT_CLASS_P@1)) CONSTANT_CLASS_P@2) - (if (tree_nop_conversion_p (type, TREE_TYPE (@0))) - /* If one of the types wraps, use that one. */ - (if (!ANY_INTEGRAL_TYPE_P (type) || TYPE_OVERFLOW_WRAPS (type)) - (if (outer_op == PLUS_EXPR) - (plus (convert @0) (inner_op @2 (convert @1))) - (minus (convert @0) (neg_inner_op @2 (convert @1)))) - (if (!ANY_INTEGRAL_TYPE_P (TREE_TYPE (@0)) - || TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))) - (if (outer_op == PLUS_EXPR) - (convert (plus @0 (inner_op (convert @2) @1))) - (convert (minus @0 (neg_inner_op (convert @2) @1)))) - /* If the constant operation overflows we cannot do the transform - directly as we would introduce undefined overflow, for example - with (a - 1) + INT_MIN. */ - (if (types_match (type, @0)) - (with { tree cst = const_binop (outer_op == inner_op - ? PLUS_EXPR : MINUS_EXPR, - type, @1, @2); } - (if (cst && !TREE_OVERFLOW (cst)) - (inner_op @0 { cst; } ) - /* X+INT_MAX+1 is X-INT_MIN. */ - (if (INTEGRAL_TYPE_P (type) && cst - && wi::eq_p (cst, wi::min_value (type))) - (neg_inner_op @0 { wide_int_to_tree (type, cst); }) - /* Last resort, use some unsigned type. */ - (with { tree utype = unsigned_type_for (type); } - (convert (inner_op - (convert:utype @0) - (convert:utype - { drop_tree_overflow (cst); })))))))))))))) + (outer_op (inner_op @0 CONSTANT_CLASS_P@1) CONSTANT_CLASS_P@2) + /* If the constant operation overflows we cannot do the transform + as we would introduce undefined overflow, for example + with (a - 1) + INT_MIN. */ + (with { tree cst = const_binop (outer_op == inner_op + ? PLUS_EXPR : MINUS_EXPR, type, @1, @2); } + (if (cst && !TREE_OVERFLOW (cst)) + (inner_op @0 { cst; } )))))) /* (CST1 - A) +- CST2 -> CST3 - A */ (for outer_op (plus minus) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8eca177d485..55aed107baa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-05-27 Jakub Jelinek + + PR bootstrap/80887 + * gcc.dg/tree-ssa/addadd.c: Xfail all scan-tree-dump*. + 2017-05-26 Nathan Sidwell * g++.dg/cpp0x/dr2061.C: New. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/addadd.c b/gcc/testsuite/gcc.dg/tree-ssa/addadd.c index 16474db6565..669cfbc47ec 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/addadd.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/addadd.c @@ -29,6 +29,6 @@ void j(S*x){ *x += __INT_MAX__; } -/* { dg-final { scan-tree-dump-times " \\+ 24;" 2 "optimized" } } */ -/* { dg-final { scan-tree-dump-times "\\(unsigned int\\)" 2 "optimized" } } */ -/* { dg-final { scan-tree-dump-not "2147483647" "optimized" } } */ +/* { dg-final { scan-tree-dump-times " \\+ 24;" 2 "optimized" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-times "\\(unsigned int\\)" 2 "optimized" { xfail *-*-* } } } */ +/* { dg-final { scan-tree-dump-not "2147483647" "optimized" { xfail *-*-* } } } */