Menu

#1092 unsupported alignment attribute

OTHER
closed
nobody
gcc (462)
works-for-me
User_Error
2013-01-31
2007-10-13
Guilhem
No

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;
}

Discussion

  • Danny Smith

    Danny Smith - 2007-10-13

    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.

     
  • Danny Smith

    Danny Smith - 2007-10-13
    • labels: 103944 --> 103947
    • status: open --> pending
     
  • Danny Smith

    Danny Smith - 2007-10-13

    Logged In: YES
    user_id=11494
    Originator: NO

    Sorry forget last comment.

     
  • Danny Smith

    Danny Smith - 2007-10-13
    • assigned_to: dannysmith --> nobody
    • labels: 103947 --> gcc
    • status: pending --> open
     
  • Danny Smith

    Danny Smith - 2007-10-16

    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

     
  • Danny Smith

    Danny Smith - 2008-06-08
    • status: open --> closed-works-for-me
     
  • Danny Smith

    Danny Smith - 2008-06-08

    Logged In: YES
    user_id=11494
    Originator: NO

    Use the __attribute__((force_align_arg_pointer)) on gcc 4.2 and higher.
    Danny

     
  • Earnie Boyd

    Earnie Boyd - 2013-01-31
    • status: closed-works-for-me --> closed
    • resolution: --> works-for-me
    • category: --> User_Error
    • milestone: Known_bugs --> OTHER
     
MongoDB Logo MongoDB