From: Richard Biener <rguenther@suse.de>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: gcc-patches@gcc.gnu.org, Michael Matz <matz@suse.de>
Subject: Re: [PATCH] Fix PR55882
Date: Tue, 15 Jan 2013 14:50:00 -0000 [thread overview]
Message-ID: <alpine.LNX.2.00.1301151548230.6889@zhemvz.fhfr.qr> (raw)
In-Reply-To: <1366843.hbPgaJ0q9u@polaris>
On Tue, 15 Jan 2013, Eric Botcazou wrote:
> > I have applied the minimal fix to trunk now. We retain the clearly
> > incorrect fact that the !align_computed path only ever increases
> > alignment (it's only ever set previously to either BITS_PER_UNIT
> > or via the MEM_REF block). I will momentarily test a followup
> > removing that block for trunk.
>
> What do we do for the 4.7 branch? The patch doesn't compile for it so I
> presume that there are one or more changes to be backported first?
Not necessarily. The following is a 4.7 variant of the patch
(on trunk get_object_alignment_1 got one extra output which
moved the align return value to by-reference).
Can you give it testing on the branch and a strict-align target?
Thanks,
Richard.
2013-01-15 Richard Biener <rguenther@suse.de>
PR middle-end/55882
* emit-rtl.c (set_mem_attributes_minus_bitpos): Correctly
account for bitpos when computing alignment.
* gcc.dg/torture/pr55882.c: New testcase.
Index: gcc/testsuite/gcc.dg/torture/pr55882.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr55882.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr55882.c (working copy)
***************
*** 0 ****
--- 1,94 ----
+ /* { dg-do run } */
+
+ typedef enum
+ {
+ PVT_A = 0,
+ PVT_B = 1,
+ PVT_CONFIG = 2,
+ PVT_RESERVED3 = 3,
+ } T_CR_SELECT;
+
+ typedef enum
+ {
+ STD_ULOGIC_0 = 0,
+ STD_ULOGIC_1 = 1,
+ } STD_ULOGIC;
+
+ typedef struct
+ {
+ unsigned char rtp : 3;
+ unsigned char rtn : 3;
+ } C;
+
+ typedef struct
+ {
+ unsigned char nd;
+ unsigned char pd;
+ unsigned char rtn;
+ unsigned char rtp;
+ } A;
+
+ typedef struct
+ {
+ unsigned short reserved : 14;
+ unsigned char Z_rx_enable : 2;
+ A pvt;
+ } B;
+
+ typedef struct
+ {
+ B cr_dsclk_q3;
+ B cr_data_q3;
+ B cr_addr_q3;
+ B cr_cmd_q3;
+ B cr_pres_q3;
+ C cr_vref_q3[6];
+ unsigned char pres_disable;
+ unsigned char pres_drive_high;
+ unsigned char c_enab_120;
+ STD_ULOGIC clk_tximp;
+ STD_ULOGIC dqs_tximp;
+ STD_ULOGIC cmd_tximp;
+ STD_ULOGIC data_tximp;
+ STD_ULOGIC dqs_rxterm;
+ STD_ULOGIC data_rxterm;
+ T_CR_SELECT cr_clk_sel;
+ unsigned char cr_clk : 5;
+ T_CR_SELECT cr_dsclk_odd_sel;
+ unsigned char cr_dsclk_odd : 5;
+ T_CR_SELECT cr_dsclk_even_sel;
+ unsigned char cr_dsclk_even : 5;
+ T_CR_SELECT cr_data_sel;
+ unsigned char cr_data : 5;
+ T_CR_SELECT cr_vref_sel;
+ unsigned char cr_vref : 5;
+ T_CR_SELECT cr_others_sel;
+ unsigned char cr_others : 5;
+ } CONFIG;
+
+ typedef struct
+ {
+ unsigned char enable_monitor;
+ unsigned short step_out_pointer : 12;
+ unsigned short hold_out_pointer : 12;
+ unsigned short enable_wr_dqs : 12;
+ unsigned short use_alt_rd_dqs : 12;
+ CONFIG io_buf;
+ } mystruct;
+
+ unsigned short __attribute__((noinline,noclone))
+ testfunction(unsigned i)
+ {
+ mystruct dmfe[8];
+ dmfe[0].use_alt_rd_dqs = 1;
+ dmfe[i].use_alt_rd_dqs = 0;
+ return dmfe[0].use_alt_rd_dqs;
+ }
+
+ extern void abort (void);
+ int main ()
+ {
+ if (testfunction(0) != 0)
+ abort ();
+ return 0;
+ }
Index: gcc/emit-rtl.c
===================================================================
--- gcc/emit-rtl.c (revision 195201)
+++ gcc/emit-rtl.c (working copy)
@@ -1839,7 +1839,12 @@ set_mem_attributes_minus_bitpos (rtx ref
if (!align_computed)
{
- unsigned int obj_align = get_object_alignment (t);
+ unsigned int obj_align;
+ unsigned HOST_WIDE_INT obj_bitpos;
+ obj_align = get_object_alignment_1 (t, &obj_bitpos);
+ obj_bitpos = (obj_bitpos - bitpos) & (obj_align - 1);
+ if (obj_bitpos != 0)
+ obj_align = (obj_bitpos & -obj_bitpos);
attrs.align = MAX (attrs.align, obj_align);
}
}
next prev parent reply other threads:[~2013-01-15 14:50 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 12:00 Richard Biener
2013-01-09 20:47 ` Eric Botcazou
2013-01-10 9:18 ` Richard Biener
2013-01-10 10:05 ` Richard Biener
2013-01-10 10:54 ` Richard Biener
2013-01-10 12:23 ` Eric Botcazou
2013-01-10 13:24 ` Michael Matz
2013-01-10 13:55 ` Richard Biener
2013-01-10 18:53 ` Eric Botcazou
2013-01-11 10:25 ` Richard Biener
2013-01-15 12:49 ` Richard Biener
2013-01-15 14:44 ` Eric Botcazou
2013-01-15 14:50 ` Richard Biener [this message]
2013-01-15 23:35 ` Eric Botcazou
2013-01-16 9:27 ` Richard Biener
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=alpine.LNX.2.00.1301151548230.6889@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=ebotcazou@adacore.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=matz@suse.de \
/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).