[Bug c++/71566] New: Attribute [[aligned(16)]] on function is ignored

milasudril at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jun 17 09:19:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71566

            Bug ID: 71566
           Summary: Attribute [[aligned(16)]] on function is ignored
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: milasudril at gmail dot com
  Target Milestone: ---

g++ does not accept [[aligned(16)]] as attribute on a function. However, the
non-standard notation works.

Example:

#include <cstdio>

__attribute__((aligned(16))) int test(int x)
    {
    printf("Address of test: %p\n",test);
    return 0;
    }

[[aligned(16)]] int test2(int x)
    {
    printf("Address of test2: %p\n",test2);
    return 0;
    }

int main()
    {
    test(0);
    test2(0);
    return 0;
    }

g++ --version && g++ -std=c++14 -Wall main.cpp && ./a.out

g++ (GCC) 6.1.0
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

main.cpp:9:32: warning: 'aligned' attribute directive ignored [-Wattributes]
 [[aligned(16)]] int test2(int x)
                                ^
Address of test: 0x4005a0
Address of test2: 0x4005c6


More information about the Gcc-bugs mailing list