public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/44903] [4.6 Regression] FAIL: gcc.dg/pr35258.c execution test
Date: Mon, 26 Jul 2010 12:22:00 -0000	[thread overview]
Message-ID: <20100726122157.30469.qmail@sourceware.org> (raw)
In-Reply-To: <bug-44903-276@http.gcc.gnu.org/bugzilla/>



------- Comment #17 from rguenth at gcc dot gnu dot org  2010-07-26 12:21 -------
One of the issues is

/* For a MEM rtx, the alignment in bits.  We can use the alignment of the
   mode as a default when STRICT_ALIGNMENT, but not if not.  */
#define MEM_ALIGN(RTX)                                                  \
(MEM_ATTRS (RTX) != 0 ? MEM_ATTRS (RTX)->align                          \
 : (STRICT_ALIGNMENT && GET_MODE (RTX) != BLKmode                       \
    ? GET_MODE_ALIGNMENT (GET_MODE (RTX)) : BITS_PER_UNIT))

this might be true during RTL, but certainly during expansion this is wrong.
It invents alignment out of thin air.

Invented by Kenner via

+Tue Oct 23 13:05:53 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
...
+       * rtl.h (MEM_ALIGN): Take default from mode, if not BLKmode, and
+       change default if unknown from 1 to BITS_PER_UNIT.

and "fixed up" partly

+Sun Jan 27 13:23:40 2002  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * emit-rtl.c (get_mem_attrs): Don't default alignment for non-BLKmode
+       if not STRICT_ALIGNMENT.
+       * rtl.h (MEM_ALIGN): Likewise.

which conditionalized it on STRICT_ALIGNMENT.

But store_field still tries to compare MEM_ALIGN for alignment.  This
could have never worked properly.

Thus, for stores I can "fix" it by doing

Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c      (revision 162526)
+++ gcc/emit-rtl.c      (working copy)
@@ -1543,7 +1543,7 @@ set_mem_attributes_minus_bitpos (rtx ref
   tree expr = MEM_EXPR (ref);
   rtx offset = MEM_OFFSET (ref);
   rtx size = MEM_SIZE (ref);
-  unsigned int align = MEM_ALIGN (ref);
+  unsigned int align = MEM_ATTRS (ref) ? MEM_ALIGN (ref) : BITS_PER_UNIT;
   HOST_WIDE_INT apply_bitpos = 0;
   tree type;

Index: gcc/expr.c
===================================================================
--- gcc/expr.c  (revision 162526)
+++ gcc/expr.c  (working copy)
@@ -4168,7 +4168,7 @@ expand_assignment (tree to, tree from, b
      Assignment of an array element at a constant index, and assignment of
      an array element in an unaligned packed structure field, has the same
      problem.  */
-  if (handled_component_p (to)
+  if (1 || handled_component_p (to)
       /* ???  We only need to handle MEM_REF here if the access is not
          a full access of the base object.  */
       || (TREE_CODE (to) == MEM_REF


but unaligned loads are not fixed by that.

Pre-existing mess.  I am not qualified to stir it more.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|rguenth at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


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


  parent reply	other threads:[~2010-07-26 12:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-10 15:17 [Bug tree-optimization/44903] New: " danglin at gcc dot gnu dot org
2010-07-10 19:46 ` [Bug tree-optimization/44903] [4.6 Regression] " danglin at gcc dot gnu dot org
2010-07-10 21:29 ` [Bug target/44903] " rguenth at gcc dot gnu dot org
2010-07-10 23:35 ` dave at hiauly1 dot hia dot nrc dot ca
2010-07-11 10:47 ` rguenth at gcc dot gnu dot org
2010-07-11 15:17 ` dave at hiauly1 dot hia dot nrc dot ca
2010-07-11 16:24 ` rguenth at gcc dot gnu dot org
2010-07-11 16:33 ` danglin at gcc dot gnu dot org
2010-07-11 16:55 ` dave at hiauly1 dot hia dot nrc dot ca
2010-07-11 22:04 ` rguenth at gcc dot gnu dot org
2010-07-11 22:22 ` dave at hiauly1 dot hia dot nrc dot ca
2010-07-11 22:37 ` rguenth at gcc dot gnu dot org
2010-07-13 13:53 ` rguenth at gcc dot gnu dot org
2010-07-13 17:41 ` mikpe at it dot uu dot se
2010-07-14  0:19 ` danglin at gcc dot gnu dot org
2010-07-23 12:14 ` rguenth at gcc dot gnu dot org
2010-07-26 12:22 ` rguenth at gcc dot gnu dot org [this message]
2010-07-26 12:45 ` rguenth at gcc dot gnu dot org
2010-07-26 12:46 ` rguenth at gcc dot gnu dot org
2010-07-28  0:22 ` dave at hiauly1 dot hia dot nrc dot ca
2010-07-28 10:33 ` rguenth at gcc dot gnu dot org
2010-07-28 10:33 ` rguenth at gcc dot gnu dot org

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=20100726122157.30469.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).