summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/loongarch/zero-size-field-ret.c
blob: 40137d97555edb0458a44af6f867e183efd9e2c8 (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
/* Test that LoongArch backend ignores zero-sized fields of aggregates in
   returning.  */

/* { dg-do compile } */
/* { dg-options "-O2 -mdouble-float -mabi=lp64d" } */
/* { dg-final { scan-assembler-not "\\\$r4" } } */

struct test
{
  int empty1[0];
  double empty2[0];
  int : 0;
  float x;
  long empty3[0];
  long : 0;
  float y;
  unsigned : 0;
  char empty4[0];
};

extern struct test callee (void);

float
caller (void)
{
  struct test test = callee ();
  return test.x + test.y;
}