diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/lto')
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr81440.h | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr81440_0.c | 9 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr81440_1.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr83954.h | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr83954_0.c | 8 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr83954_1.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr85248_0.c | 45 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/lto/pr85248_1.c | 9 |
8 files changed, 91 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/lto/pr81440.h b/gcc/testsuite/gcc.dg/lto/pr81440.h new file mode 100644 index 00000000000..d9e6c3da645 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr81440.h @@ -0,0 +1,4 @@ +typedef struct { + int i; + int ints[]; +} struct_t; diff --git a/gcc/testsuite/gcc.dg/lto/pr81440_0.c b/gcc/testsuite/gcc.dg/lto/pr81440_0.c new file mode 100644 index 00000000000..07f2a87da21 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr81440_0.c @@ -0,0 +1,9 @@ +/* { dg-lto-do link } */ + +#include "pr81440.h" + +extern struct_t my_struct; + +int main() { + return my_struct.ints[0]; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr81440_1.c b/gcc/testsuite/gcc.dg/lto/pr81440_1.c new file mode 100644 index 00000000000..d03533029c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr81440_1.c @@ -0,0 +1,6 @@ +#include "pr81440.h" + +struct_t my_struct = { + 20, + { 1, 2 } +}; diff --git a/gcc/testsuite/gcc.dg/lto/pr83954.h b/gcc/testsuite/gcc.dg/lto/pr83954.h new file mode 100644 index 00000000000..e0155402504 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr83954.h @@ -0,0 +1,3 @@ +struct foo; +extern struct foo *FOO_PTR_ARR[1]; + diff --git a/gcc/testsuite/gcc.dg/lto/pr83954_0.c b/gcc/testsuite/gcc.dg/lto/pr83954_0.c new file mode 100644 index 00000000000..065a31dab80 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr83954_0.c @@ -0,0 +1,8 @@ +/* { dg-lto-do link } */ +#include "pr83954.h" + +int main() { + // just to prevent symbol removal + FOO_PTR_ARR[1] = 0; + return 0; +} diff --git a/gcc/testsuite/gcc.dg/lto/pr83954_1.c b/gcc/testsuite/gcc.dg/lto/pr83954_1.c new file mode 100644 index 00000000000..61b40fc7759 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr83954_1.c @@ -0,0 +1,7 @@ +#include "pr83954.h" + +struct foo { + int x; +}; +struct foo *FOO_PTR_ARR[1] = { 0 }; + diff --git a/gcc/testsuite/gcc.dg/lto/pr85248_0.c b/gcc/testsuite/gcc.dg/lto/pr85248_0.c new file mode 100644 index 00000000000..df61ac976a5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr85248_0.c @@ -0,0 +1,45 @@ +/* PR lto/85248 */ +/* { dg-lto-do run } */ +/* { dg-lto-options { { -flto -O2 } } } */ + +extern void test_alias (int s, int e) __asm__ (__USER_LABEL_PREFIX__ "test"); +extern void test_noreturn (int s, int e) __asm__ (__USER_LABEL_PREFIX__ "test") + __attribute__ ((__noreturn__)); + +extern inline __attribute__ ((__always_inline__, __gnu_inline__)) void +test (int s, int e) +{ + if (__builtin_constant_p (s) && s != 0) + test_noreturn (s, e); + else + test_alias (s, e); +} + +int +foo (void) +{ + static volatile int a; + return a; +} + +static void +bar (void) +{ + test (0, 1); + __builtin_exit (0); +} + +static void +baz () +{ + test (1, 0); +} + +int +main () +{ + if (foo ()) + baz (); + bar (); + __builtin_abort (); +} diff --git a/gcc/testsuite/gcc.dg/lto/pr85248_1.c b/gcc/testsuite/gcc.dg/lto/pr85248_1.c new file mode 100644 index 00000000000..5ce257181fb --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr85248_1.c @@ -0,0 +1,9 @@ +/* { dg-options "-fno-lto" } */ + +void +test (int s, int e) +{ + asm volatile ("" : "+g" (s), "+g" (e) : : "memory"); + if (s) + __builtin_abort (); +} |