blob: 06fa3a0d3d3411053c21f49dfb3c0bf3541ad569 (
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
|
/* PR tree-optimization/84339 */
struct S { int a; char b[1]; };
__attribute__((noipa)) int
foo (struct S *p)
{
return __builtin_strlen (&p->b[0]);
}
__attribute__((noipa)) int
bar (struct S *p)
{
return __builtin_strlen (p->b);
}
int
main ()
{
struct S *p = __builtin_malloc (sizeof (struct S) + 16);
if (p)
{
p->a = 1;
__builtin_strcpy (p->b, "abcdefg");
if (foo (p) != 7 || bar (p) != 7)
__builtin_abort ();
__builtin_free (p);
}
return 0;
}
|