public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amonakov at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/43236] -ftree-loop-distribution produces wrong code in reload1.c:delete_output_reload(), bootstrap fails
Date: Wed, 03 Mar 2010 13:07:00 -0000	[thread overview]
Message-ID: <20100303130654.5156.qmail@sourceware.org> (raw)
In-Reply-To: <bug-43236-14164@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from amonakov at gcc dot gnu dot org  2010-03-03 13:06 -------
Not a regression, off-by-one error in reverse iteration case is since day one.
Patch:
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 13ac7ea..110abdc 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -285,6 +285,8 @@ generate_memset_zero (gimple stmt, tree op0, tree nb_iter,
       addr_base = fold_convert_loc (loc, sizetype, addr_base);
       addr_base = size_binop_loc (loc, MINUS_EXPR, addr_base,
                                  fold_convert_loc (loc, sizetype, nb_bytes));
+      addr_base = size_binop_loc (loc, PLUS_EXPR, addr_base,
+                                 TYPE_SIZE_UNIT (TREE_TYPE (op0)));
       addr_base = fold_build2_loc (loc, POINTER_PLUS_EXPR,
                                   TREE_TYPE (DR_BASE_ADDRESS (dr)),
                                   DR_BASE_ADDRESS (dr), addr_base);

This fixes the -O[123] miscompilations. -Os is slightly harder to fix, since we
use wrong number of iterations (cond bb is executed 11 times, latch bb with
assignment 10 times).


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43236


  parent reply	other threads:[~2010-03-03 13:07 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 20:14 [Bug tree-optimization/43236] New: " zsojka at seznam dot cz
2010-03-02 20:21 ` [Bug tree-optimization/43236] " zsojka at seznam dot cz
2010-03-02 20:34 ` zsojka at seznam dot cz
2010-03-03  6:27 ` zsojka at seznam dot cz
2010-03-03  6:31 ` zsojka at seznam dot cz
2010-03-03 10:38 ` rguenth at gcc dot gnu dot org
2010-03-03 13:07 ` amonakov at gcc dot gnu dot org [this message]
2010-03-03 13:39 ` amonakov at gcc dot gnu dot org
2010-03-09 16:56 ` amonakov at gcc dot gnu dot org
2010-03-10 12:54 ` amonakov at gcc dot gnu dot org
2010-03-10 12:57 ` amonakov at gcc dot gnu dot org
2010-03-10 14:17 ` sezeroz at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100303130654.5156.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).