libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / attr-assume_aligned-4.c
blobf6eb6dc4e59330fcf056f313d6c64830672a5165
1 /* PR middle-end/87533 - bogus assume_aligned attribute silently accepted
2 { dg-do compile }
3 { dg-options "-Wall" } */
5 #define A(...) __attribute__ ((assume_aligned (__VA_ARGS__)))
7 A (1) void fv_1 (void); /* { dg-warning ".assume_aligned. attribute ignored on a function returning .void." } */
9 A (1) int fi_1 (void); /* { dg-warning ".assume_aligned. attribute ignored on a function returning .int." } */
11 A (-1) void* fpv_m1 (void); /* { dg-warning ".assume_aligned. attribute argument -1 is not positive" } */
13 A (0) void* fpv_0 (void); /* { dg-warning ".assume_aligned. attribute argument 0 is not a power of 2" } */
15 /* Alignment of 1 is fine, it just doesn't offer any benefits. */
16 A (1) void* fpv_1 (void);
18 A (3) void* fpv_3 (void); /* { dg-warning ".assume_aligned. attribute argument 3 is not a power of 2" } */
20 A (16383) void* fpv_16km1 (void); /* { dg-warning ".assume_aligned. attribute argument 16383 is not a power of 2" } */
21 A (16384) void* fpv_16k (void);
22 A (16385) void* fpv_16kp1 (void); /* { dg-warning ".assume_aligned. attribute argument 16385 is not a power of 2" } */
24 A (32767) void* fpv_32km1 (void); /* { dg-warning ".assume_aligned. attribute argument 32767 is not a power of 2" } */
26 A (4, -1) void* fpv_4_m1 (void); /* { dg-warning ".assume_aligned. attribute argument -1 is not positive" } */
28 A (4, 0) void* fpv_4_0 (void);
29 A (4, 1) void* fpv_4_1 (void);
30 A (4, 2) void* fpv_4_2 (void);
31 A (4, 3) void* fpv_4_3 (void);
33 A (4, 4) void* fpv_4_3 (void); /* { dg-warning ".assume_aligned. attribute argument 4 is not in the range \\\[0, 3]" } */
35 A (4) void* gpv_4_3 (void);
36 A (2) void* gpv_4_3 (void);