comparison gcc/testsuite/gcc.dg/pr31507-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* PR target/31507 */
2 /* { dg-do run } */
3 /* { dg-options "-Os -fno-omit-frame-pointer" } */
4 /* { dg-require-effective-target alloca } */
5
6 extern void abort (void);
7
8 __attribute__((noinline)) void
9 foo (double d0, double d1, double d2, double d3,
10 double d4, double d5, double d6, double d7,
11 float f0, float f1, float f2, float f3,
12 char *p)
13 {
14 if (d0 != 0 || d1 != 1 || d2 != 2 || d3 != 3)
15 abort ();
16 if (d4 != 4 || d5 != 5 || d6 != 6 || d7 != 7)
17 abort ();
18 if (f0 != 10 || f1 != 11 || f2 != 12 || f3 != 13)
19 abort ();
20 if (__builtin_memcmp (p, "foo", 4) != 0)
21 abort ();
22 __builtin_memcpy (p, "bar", 4);
23 }
24
25 __attribute__((noinline)) void
26 bar (int x)
27 {
28 char p[x];
29 if (x >= sizeof "foo")
30 __builtin_memcpy (p, "foo", 4);
31 foo (0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0,
32 10.0f, 11.0f, 12.0f, 13.0f, p);
33 if (x >= sizeof "bar" && __builtin_memcmp (p, "bar", 4) != 0)
34 abort ();
35 }
36
37 int
38 main (void)
39 {
40 bar (128);
41 return 0;
42 }