diff options
Diffstat (limited to 'validation/expand')
| -rw-r--r-- | validation/expand/builtin_constant_inline0.c | 24 | ||||
| -rw-r--r-- | validation/expand/builtin_constant_inline1.c | 24 |
2 files changed, 48 insertions, 0 deletions
diff --git a/validation/expand/builtin_constant_inline0.c b/validation/expand/builtin_constant_inline0.c new file mode 100644 index 00000000..9e775d5e --- /dev/null +++ b/validation/expand/builtin_constant_inline0.c @@ -0,0 +1,24 @@ +static inline int is_const(long size) +{ + return __builtin_constant_p(size) ? size : 0; +} + +int foo(void) +{ + return is_const(42); +} + +/* + * check-name: builtin_constant_inline0 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-start +foo: +.L0: + <entry-point> + ret.32 $42 + + + * check-output-end + */ diff --git a/validation/expand/builtin_constant_inline1.c b/validation/expand/builtin_constant_inline1.c new file mode 100644 index 00000000..da08f960 --- /dev/null +++ b/validation/expand/builtin_constant_inline1.c @@ -0,0 +1,24 @@ +static inline void fun(void) { } + +#define EXPR ({ fun(); 42; }) + +int bar(void) +{ + // GCC doesn't consider EXPR as a constant + return __builtin_constant_p(EXPR); +} + +/* + * check-name: builtin_constant_inline1 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-start +bar: +.L0: + <entry-point> + ret.32 $0 + + + * check-output-end + */ |
