1 /* PR middle-end/81871 - bogus attribute alloc_align accepted
3 { dg-options "-Wall" } */
5 #define ALIGN(N) __attribute__ ((alloc_align (N)))
6 #define SIZE_MAX __SIZE_MAX__
8 ALIGN (1) void fvv_m1 (void); /* { dg-warning ".alloc_align. attribute ignored on a function returning .void." } */
10 ALIGN (1) int fiv_1 (void); /* { dg-warning ".alloc_align. attribute ignored on a function returning .int." } */
12 ALIGN (0) void* fpvv_0 (void); /* { dg-warning ".alloc_align. attribute argument value .0. does not refer to a function parameter" } */
14 ALIGN (1) void* fpvv_1 (void); /* { dg-warning ".alloc_align. attribute argument value .1. exceeds the number of function parameters 0" } */
16 ALIGN (2) void* fii_2 (int); /* { dg-warning ".alloc_align. attribute argument value .2. exceeds the number of function parameters 1" } */
18 ALIGN (1) void fvi_1 (int); /* { dg-warning ".alloc_align. attribute ignored on a function returning .void." } */
20 /* Using alloc_align with a function returning a pointer to a function
21 should perhaps trigger a warning. */
22 typedef void (F
)(void);
23 ALIGN (1) F
* fpF_i_1 (int);
25 ALIGN (SIZE_MAX
) void*
26 fpvi_szmax (int); /* { dg-warning ".alloc_align. attribute argument value .\[0-9\]+. exceeds the number of function parameters 1" } */
29 fpvi_str_1 (int); /* { dg-warning ".alloc_align. attribute argument has type .char\\\[2]" } */
31 ALIGN ((void*)0) void*
32 fpvi_pv0 (int); /* { dg-warning ".alloc_align. attribute argument has type .void \\\*." } */
34 ALIGN ((double*)1) void*
35 fpvi_pd1 (int); /* { dg-warning ".alloc_align. attribute argument has type .double \\\*." } */
38 fpvi_pv_1 (void*); /* { dg-warning ".alloc_align. attribute argument value .1. refers to parameter type .void \\\*." } */
42 fpvi_S_2 (int, struct S
); /* { dg-warning ".alloc_align. attribute argument value .2. refers to parameter type .struct S." } */