blob: 2db1c29caa6b33a110c0fa82d1f2c9075bdc71bb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* PR debug/43150 */
/* { dg-do run } */
/* { dg-options "-g" } */
void __attribute__((noinline))
bar (short *p)
{
__builtin_memset (p, '\0', 17 * sizeof (*p));
asm volatile ("" : : "r" (p) : "memory");
}
int __attribute__((noinline))
f1 (int i)
{
char a[i + 1];
a[0] = 5; /* { dg-final { gdb-test 17 "i" "5" } } */
return a[0]; /* { dg-final { gdb-test 17 "sizeof (a)" "6" } } */
}
int __attribute__((noinline))
f2 (int i)
{
short a[i * 2 + 7]; /* { dg-final { gdb-test 24 "i" "5" } } */
bar (a); /* { dg-final { gdb-test 24 "sizeof (a)" "17 * sizeof (short)" } } */
return a[i + 4];
}
int
main ()
{
int i = 5;
asm volatile ("" : "=r" (i) : "0" (i));
f1 (i);
f2 (i);
return 0;
}
|