Hi,
I have been looking forward to the release of MinGW's GCC 4.2.x for the principal reason that alignment attribute is broken in earlier versions of GCC.
Yet, a test with the latest technology preview (-sjlj version) from the MinGW download page showed that alignment does not work here either:
int value __attribute__ ((__aligned__ (16)));
should be 128-bit aligned, but isn't.
Hoping this can get rectified for MinGW's final release of GCC 4.2.x ...
* OS version: Windows XP
* gcc version: 4.2.1-sjlj
* ld version: 2.16.91
* mingw version: MinGW-5.1.3.exe
* build environment: MSYS
* MSYS version number: MINGW32_NT-5.1 GUILHEM 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown
* small test case: see below
* mingw-runtime version: 3.13
* w32api version: 3.10
The test code (copied from FFMPEG) is:
#ifdef __GNUC__
#define DECLARE_ALIGNED_16(t,v) t v __attribute__ ((__aligned__ (16)))
#else
#define DECLARE_ALIGNED_16(t,v) __declspec(align(16)) t v
#endif
int ff_check_alignment(void){
static int did_fail=0;
DECLARE_ALIGNED_16(int, aligned);
if((long)&aligned & 15){
if(!did_fail){
av_log(NULL, AV_LOG_ERROR,
"Compiler did not align stack variables. Libavcodec has been miscompiled\n"
"and may be very slow or crash. This is not a bug in libavcodec,\n"
"but in the compiler. Do not report crashes to FFmpeg developers.\n");
did_fail=1;
}
return -1;
}
return 0;
}
Logged In: YES
user_id=11494
Originator: NO
The test case does not show a compiler bug, but rather an old bug in binutils BFD library. Try a more recent binutils package.
Logged In: YES
user_id=11494
Originator: NO
Sorry forget last comment.
Logged In: YES
user_id=11494
Originator: NO
Your test case is a bit lame, but I think this is the problem you are seeing:
http://arrozcru.no-ip.org/ffmpeg_forum/viewtopic.php?t=568
Logged In: YES
user_id=11494
Originator: NO
Use the __attribute__((force_align_arg_pointer)) on gcc 4.2 and higher.
Danny