works with 4.3 branch, fails with 4.4 branch and trunk 20100109, not seen with -O1 Matthias $ gcc-4.4 -c -g -O2 fs_ntfs.i fs_ntfs.c: In function 'ntfs_getinfo': fs_ntfs.c:102: internal compiler error: in get_aligned_mem, at config/alpha/alpha.c:1466 Please submit a full bug report, with preprocessed source if appropriate.
Created attachment 19633 [details] preprocessed source
Reproduced with an alpha-unknown-linux cross hosted on i686, built from gcc-4.4-20100112.
Well, gcc would just generate invalid code without this assert. Reduced test: --cut here-- typedef unsigned short int uint16_t; typedef unsigned int uint32_t; typedef unsigned long int uint64_t; typedef uint16_t u16; typedef uint32_t u32; typedef uint64_t u64; enum { FSYSHEADKEY_NULL = 0, FSYSHEADKEY_FILESYSTEM, FSYSHEADKEY_MNTPATH, FSYSHEADKEY_BYTESTOTAL, FSYSHEADKEY_MINFSAVERSION, FSYSHEADKEY_MOUNTINFO, FSYSHEADKEY_ORIGDEV, FSYSHEADKEY_FSEXTEOPTRAIDSTRIDE }; typedef struct s_dico { } cdico; struct s_ntfsinfo { u32 bytes_per_sector; u64 uuid; }; enum { MSG_FORCE = 0, MSG_VERB1 = 1, MSG_VERB2 = 2, MSG_STACK = 3, MSG_DEBUG1 = 4, MSG_DEBUG2 = 5, MSG_DEBUG3 = 6, MSG_DEBUG4 = 7, MSG_DEBUG5 = 8 }; ntfs_getinfo (cdico * d, char *devname) { struct s_ntfsinfo info; char bootsect[512]; int fd = -1; info.bytes_per_sector = ((u16) (*((u16 *) (bootsect + 0xB)))); foo (info.bytes_per_sector); info.uuid = ((u64) (*((u64 *) (bootsect + 0x48)))); fsaprintf (MSG_VERB2, 0, MSG_VERB2 >= 3, "fs_ntfs.c", __FUNCTION__, 107, "bytes_per_sector=[%lld]\n", (long long) info.bytes_per_sector); fsaprintf (MSG_VERB2, 0, MSG_VERB2 >= 3, "fs_ntfs.c", __FUNCTION__, 109, "uuid=[%016llX]\n", (long long unsigned int) info.uuid); dico_add_u64 (d, 0, FSYSHEADKEY_MINFSAVERSION, ((u64) ((((u64) 0 & 0xFFFF) << 48) + (((u64) 6 & 0xFFFF) << 32) + (((u64) 4 & 0xFFFF) << 16) + (((u64) 0 & 0xFFFF) << 0)))); } --cut here-- Problematic line is bootsect + 0xB that crosses SImode aligned load.
Created attachment 19638 [details] reduced test case I'm attaching a really tiny test case. The trigger appears to be a 2-byte load from the stack that crosses the boundary between two adjacent 4-byte ints.
Is this related to PR 39954?
Created attachment 19640 [details] Patch to teach {,un}aligned_memory_operand about unaligned offsets Mikael, can you please test attached patch on your target? Unaligned offsets should be classified as unaligned memory access.
Uros' proposed patch fixes the ICE in gcc-4.5. It doesn't apply to 4.4 though.
Created attachment 19642 [details] Patch for 4.3 and 4.4 branch.
Uros' proposed fix for 4.4 and 4.3 fixes the ICE on both branches. The original report stated that 4.3 doesn't ICE. A vanilla 4.3-20100103 definitely ICEs for me on the reduced test case.
Patch at http://gcc.gnu.org/ml/gcc-patches/2010-01/msg00958.html
Subject: Bug 42774 Author: uros Date: Mon Jan 18 17:04:29 2010 New Revision: 156014 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156014 Log: PR target/42774 * config/alpha/predicates.md (aligned_memory_operand): Return 0 for memory references with unaligned offsets. Remove CQImode handling. (unaligned_memory_operand): Return 1 for memory references with unaligned offsets. Remove CQImode handling. testsuite/ChangeLog: PR target/42774 * gcc.target/alpha/pr42774.c: New test. Added: branches/gcc-4_4-branch/gcc/testsuite/gcc.target/alpha/pr42774.c Modified: branches/gcc-4_4-branch/gcc/ChangeLog branches/gcc-4_4-branch/gcc/config/alpha/predicates.md branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
Subject: Bug 42774 Author: uros Date: Mon Jan 18 17:46:17 2010 New Revision: 156017 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156017 Log: PR target/42774 * config/alpha/predicates.md (aligned_memory_operand): Return 0 for memory references with unaligned offsets. Remove CQImode handling. (unaligned_memory_operand): Return 1 for memory references with unaligned offsets. Remove CQImode handling. testsuite/ChangeLog: PR target/42774 * gcc.target/alpha/pr42774.c: New test. Added: trunk/gcc/testsuite/gcc.target/alpha/pr42774.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/alpha/predicates.md trunk/gcc/testsuite/ChangeLog
Subject: Bug 42774 Author: uros Date: Mon Jan 18 21:44:32 2010 New Revision: 156024 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=156024 Log: PR target/42774 * config/alpha/predicates.md (aligned_memory_operand): Return 0 for memory references with unaligned offsets. Remove CQImode handling. (unaligned_memory_operand): Return 1 for memory references with unaligned offsets. Remove CQImode handling. testsuite/ChangeLog: PR target/42774 * gcc.target/alpha/pr42774.c: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/gcc.target/alpha/pr42774.c Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/alpha/predicates.md branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
Fixed.