aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr17526.c
blob: 58b479143a8f50182802e8532593f8ee59fa3fab (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
/* { dg-do run } */
/* { dg-options "-fno-pcc-struct-return" { target i?86-*-* } } */

void abort(void);

typedef struct { int i; } A;

A __attribute__((noinline))
foo(void)
{
    A a = { -1 };
    return a;
}

void __attribute__((noinline))
bar(A *p)
{
    *p = foo();
}

int main(void)
{
    A a;
    bar(&a);
    if (a.i != -1) abort();
    return 0;
}