public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/17949] New: Tree loop optimization generates unaligned access (STRICT_ALIGNMENT is set)
@ 2004-10-12 17:21 sje at cup dot hp dot com
  2004-10-12 17:25 ` [Bug tree-optimization/17949] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: sje at cup dot hp dot com @ 2004-10-12 17:21 UTC (permalink / raw)
  To: gcc-bugs

IA64 sets STRICT_ALIGNMENT to 1 but the tree loop optimizer is converting byte
loads into a unaligned word load (and thus creating an unaligned access).

The attached program compiles and runs with no optimization, fails with -O1 and
works with -O1 -fno-tree-loop-optimize.  With -O1 running the executable core
dumps on IA64 HP-UX and gives an "Unaligned Access" error message on IA64 Linux.

Test case:

    typedef struct
    {
        short i __attribute__ ((packed));
        int f[2] __attribute__ ((packed));
    } A;

    A a;
    int i;

    main ()
    {
        int j;
        for (j = 0; j < 2; j++)
                i += a.f[j];
    }

-- 
           Summary: Tree loop optimization generates unaligned access
                    (STRICT_ALIGNMENT is set)
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sje at cup dot hp dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: ia64-hp-hpux11.23
  GCC host triplet: ia64-hp-hpux11.23
GCC target triplet: ia64-hp-hpux11.23


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


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

end of thread, other threads:[~2005-01-12  0:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-12 17:21 [Bug tree-optimization/17949] New: Tree loop optimization generates unaligned access (STRICT_ALIGNMENT is set) sje at cup dot hp dot com
2004-10-12 17:25 ` [Bug tree-optimization/17949] [4.0 Regression] " pinskia at gcc dot gnu dot org
2004-12-05  5:01 ` pinskia at gcc dot gnu dot org
2004-12-20 11:50 ` steven at gcc dot gnu dot org
2004-12-20 12:49 ` falk at debian dot org
2004-12-20 13:35 ` rakdver at atrey dot karlin dot mff dot cuni dot cz
2004-12-20 14:00 ` pinskia at gcc dot gnu dot org
2004-12-26 17:16 ` pinskia at gcc dot gnu dot org
2004-12-26 17:17 ` pinskia at gcc dot gnu dot org
2004-12-30 22:30 ` rakdver at gcc dot gnu dot org
2004-12-31 19:15 ` pinskia at gcc dot gnu dot org
2005-01-01 16:28 ` dave at hiauly1 dot hia dot nrc dot ca
2005-01-12  0:06 ` cvs-commit at gcc dot gnu dot org
2005-01-12  0:07 ` rakdver 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).