This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/19857] New: alignment check of SSE constant fails in simple test program
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Feb 2005 17:04:12 -0000
- Subject: [Bug c/19857] New: alignment check of SSE constant fails in simple test program
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When I compile a simple test program that declares an SSE constant and checks
that it is 8-byte aligned (see below), the alignment check fails in the
gcc 4.0 snapshot (it succeeds in 3.3.5).
I'm not sure whether the constant is actually misaligned or the alignment
check itself is miscompiled...changing the check slightly makes it succeed.
Environment:
System: Linux fftw.org 2.6.3-1-686-smp #2 SMP Tue Feb 24 20:29:08 EST 2004 i686 GNU/Linux
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure --prefix=/home/stevenj/gcc4
How-To-Repeat:
Compile the following code with 'gcc -O3 -msse -o bug bug.c' and run
with './bug && echo ok' ... output *should* be "ok" (ALIGNED==true),
but is not.
(Yes, the way the alignment check is performed looks kinda weird...it
is distilled from other code (www.fftw.org), obviously...but it should
still pass for any 8-byte aligned quantity.)
Thanks for looking into this,
Steven G. Johnson
typedef float V __attribute__ ((vector_size (16)));
union fvec {
float f[4];
V v;
};
typedef unsigned int uintptr_t;
#define ALIGNMENT 8
#define TAINT_BIT 1
#define UNTAINT(p) ((float *) (((uintptr_t) (p)) & ~(uintptr_t)3))
#define PTRINT(p) ((uintptr_t)(p))
#define ALIGNED(p) \
(((PTRINT(UNTAINT(p)) % ALIGNMENT) == 0) && !(PTRINT(p) & TAINT_BIT))
const union fvec foo = {{-0.0, 0.0, -0.0, 0.0}};
int main(void)
{
return !ALIGNED(&foo);
}
--
Summary: alignment check of SSE constant fails in simple test
program
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: critical
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: stevenj at fftw dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19857