From 5a1f5f9a3c83a1e1c5a6d61625909a451effae15 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Tue, 7 Dec 2010 15:27:50 +0000 Subject: [PATCH] Fix PR42327: use build_int_cst. 2010-12-07 Sebastian Pop PR tree-optimization/42327 * tree-data-ref.c (omega_setup_subscript): Call build_int_cst instead of using integer_minus_one_node. * gcc.dg/tree-ssa/pr42327.c: New. From-SVN: r167548 --- gcc/ChangeLog | 12 +++++++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr42327.c | 7 +++++++ gcc/tree-data-ref.c | 4 +++- 4 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr42327.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 215652907c4..a684364fda9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-12-07 Sebastian Pop + + PR tree-optimization/42327 + * tree-data-ref.c (omega_setup_subscript): Call build_int_cst + instead of using integer_minus_one_node. + 2010-12-07 Nathan Froyd PR c++/45330 @@ -27,7 +33,7 @@ * targhook.h: Declare it. * doc/tm.texi.in: New hook TARGET_PREFERRED_RENAME_CLASS. * doc/tm.texi: Regenerate. - + 2010-12-07 Jakub Jelinek PR debug/46799 @@ -186,7 +192,7 @@ * c-family/c-format.c: Same change. * c-family/stub-objc.c: Same change. * c-decl.c: Include c-family/c-objc.h. - * c-parser.c: Same change. + * c-parser.c: Same change. * c-typeck.c: Same change. * c-config-lang.in (gtfiles): Added c-family/c-objc.h. * Makefile.in (c-decl.o): Depend on c-family/c-objc.h. @@ -196,7 +202,7 @@ (c-family/stub-objc.o): Same change. (c-family/c-common.o): Same change. (PLUGIN_HEADERS): Added c-family/c-objc.h. - + 2010-12-05 John David Anglin * config.gcc [hppa[12]*-*-hpux10*, hppa[12]*-*-hpux11*]: Ignore diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 318477e245a..520be3f5292 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-12-06 Sebastian Pop + + PR tree-optimization/42327 + * gcc.dg/tree-ssa/pr42327.c: New. + 2010-12-07 Nathan Froyd PR c++/45330 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr42327.c b/gcc/testsuite/gcc.dg/tree-ssa/pr42327.c new file mode 100644 index 00000000000..c0d3811b249 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr42327.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O1 -fcheck-data-deps" } */ + +void foo(char *str) +{ + while (*str != 0) *str++ = 0; +} diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 094d16822a9..4dfcd5cafd4 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -3482,6 +3482,7 @@ omega_setup_subscript (tree access_fun_a, tree access_fun_b, tree fun_a = chrec_convert (type, access_fun_a, NULL); tree fun_b = chrec_convert (type, access_fun_b, NULL); tree difference = chrec_fold_minus (type, fun_a, fun_b); + tree minus_one; /* When the fun_a - fun_b is not constant, the dependence is not captured by the classic distance vector representation. */ @@ -3496,7 +3497,8 @@ omega_setup_subscript (tree access_fun_a, tree access_fun_b, return true; } - fun_b = chrec_fold_multiply (type, fun_b, integer_minus_one_node); + minus_one = build_int_cst (type, -1); + fun_b = chrec_fold_multiply (type, fun_b, minus_one); eq = omega_add_zero_eq (pb, omega_black); if (!init_omega_eq_with_af (pb, eq, DDR_NB_LOOPS (ddr), fun_a, ddr)