view gcc/testsuite/gcc.dg/lto/20120723_1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* Make sure that by reference and by value aggregate jump functions do not get
   mixed up.  */

extern void abort (void);

struct S
{
  int i;
  void (*f)(struct S *);
  int j;
};

struct E
{
  struct S *p;
};

extern struct S *gs;
extern int gr;
extern char gc[1024];

static __attribute__ ((noinline, noclone)) struct S *
get_s (void)
{
  return (struct S *) &gc;
}

static void good_target (struct S *s)
{
  gr = 0;
}

extern void bar (struct E e);

void foo (struct E e)
{
  gs->f = good_target;
  bar (e);
}