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