From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30579 invoked by alias); 26 Jul 2010 12:22:26 -0000 Received: (qmail 30470 invoked by uid 48); 26 Jul 2010 12:21:57 -0000 Date: Mon, 26 Jul 2010 12:22:00 -0000 Message-ID: <20100726122157.30469.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug target/44903] [4.6 Regression] FAIL: gcc.dg/pr35258.c execution test In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rguenth at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-07/txt/msg02843.txt.bz2 ------- 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 + ... + * 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 + + * 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