public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35178]  New: Misaligned Accesses on arrays of packed stucts
@ 2008-02-13 13:39 chrbr at gcc dot gnu dot org
  2008-02-13 13:43 ` [Bug c/35178] " chrbr at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: chrbr at gcc dot gnu dot org @ 2008-02-13 13:39 UTC (permalink / raw)
  To: gcc-bugs

This bug was noticed on sh but potentially impacts other STRICT_ALIGNMENT
targets. 

The attached test case reduces a misaligned field access from an array of
packed structs. In this example compiled with -O2 the field wMaxPacketSize is
accessed (on sh4) with a mov.w instruction although it is byte aligned.

It seems that the tree-ssa-loop ivopts did not check packed struct offsets
indexed by an induction variable. Thus if the struct size is not aligned, the
field  becomes unaligned after the first iteration even if it was aligned from
the base of this structure.

The proposed patch solves this problem by expanding may_be_unaligned_p to check
that a loop carried offset is a multiple of the desired alignment.


-- 
           Summary: Misaligned Accesses on arrays of packed stucts
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chrbr at gcc dot gnu dot org
GCC target triplet: sh4-linux


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/35178] Misaligned Accesses on arrays of packed stucts
  2008-02-13 13:39 [Bug c/35178] New: Misaligned Accesses on arrays of packed stucts chrbr at gcc dot gnu dot org
@ 2008-02-13 13:43 ` chrbr at gcc dot gnu dot org
  2008-02-13 13:46 ` chrbr at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: chrbr at gcc dot gnu dot org @ 2008-02-13 13:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from chrbr at gcc dot gnu dot org  2008-02-13 13:42 -------
Created an attachment (id=15138)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15138&action=view)
gcc testsuite case


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/35178] Misaligned Accesses on arrays of packed stucts
  2008-02-13 13:39 [Bug c/35178] New: Misaligned Accesses on arrays of packed stucts chrbr at gcc dot gnu dot org
  2008-02-13 13:43 ` [Bug c/35178] " chrbr at gcc dot gnu dot org
@ 2008-02-13 13:46 ` chrbr at gcc dot gnu dot org
  2008-02-13 14:27 ` rguenth at gcc dot gnu dot org
  2008-02-19  7:54 ` [Bug tree-optimization/35178] " chrbr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: chrbr at gcc dot gnu dot org @ 2008-02-13 13:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from chrbr at gcc dot gnu dot org  2008-02-13 13:45 -------
Created an attachment (id=15139)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15139&action=view)
Proposed patch

regression tested on sh-superh-elf and sh4-linux-gnu.
and bootstraped for i686-pc-linux-gnu. 


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/35178] Misaligned Accesses on arrays of packed stucts
  2008-02-13 13:39 [Bug c/35178] New: Misaligned Accesses on arrays of packed stucts chrbr at gcc dot gnu dot org
  2008-02-13 13:43 ` [Bug c/35178] " chrbr at gcc dot gnu dot org
  2008-02-13 13:46 ` chrbr at gcc dot gnu dot org
@ 2008-02-13 14:27 ` rguenth at gcc dot gnu dot org
  2008-02-19  7:54 ` [Bug tree-optimization/35178] " chrbr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-02-13 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2008-02-13 14:27 -------
patches should be sent to the gcc-patches mailing list.


-- 


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/35178] Misaligned Accesses on arrays of packed stucts
  2008-02-13 13:39 [Bug c/35178] New: Misaligned Accesses on arrays of packed stucts chrbr at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-02-13 14:27 ` rguenth at gcc dot gnu dot org
@ 2008-02-19  7:54 ` chrbr at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: chrbr at gcc dot gnu dot org @ 2008-02-19  7:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from chrbr at gcc dot gnu dot org  2008-02-19 07:53 -------
fixed in mainline


-- 

chrbr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2008-
                   |                            |02/msg00690.html
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-19  7:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-13 13:39 [Bug c/35178] New: Misaligned Accesses on arrays of packed stucts chrbr at gcc dot gnu dot org
2008-02-13 13:43 ` [Bug c/35178] " chrbr at gcc dot gnu dot org
2008-02-13 13:46 ` chrbr at gcc dot gnu dot org
2008-02-13 14:27 ` rguenth at gcc dot gnu dot org
2008-02-19  7:54 ` [Bug tree-optimization/35178] " chrbr at gcc dot gnu dot org

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