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

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Clang prints:

  a.c:1:22: warning: 'alloc_align' attribute only applies to return values that
are pointers or references [-Wignored-attributes]

After changing the return type to void*, Clang then prints:

  a.c:1:30: error: 'alloc_align' attribute argument may only refer to a
function parameter of integer type

GCC accepts both without a warning.  In fact, GCC accepts alloc_align even on
function declarations where the argument is not an integer, such as in:

  struct S { };
  __attribute__ ((alloc_align (1))) void* f (struct S);

Clang detects this as well:

  a.c:2:30: error: 'alloc_align' attribute argument may only refer to a
function parameter of integer type

Reply via email to