summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/lto/ipareference_0.c
blob: f8970f0e9ece673a6a62265f720128f9661a6142 (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
/* { dg-lto-options {{ -O1 -flto -flto-partition=1to1 }} } */
/* { dg-lto-do run } */

/* Test that ipa-reference notice that get_val will not change since do_nothing does not
   modify anything.  This needs streaming cross file boundary summaries.  */
extern int get_val (void);
extern int set_val (void);
extern do_nothing (void);
void abort (void);
main()
{
  int a;
  int b;
  set_val ();
  a = get_val ();
  do_nothing();
  b = get_val ();
  if (a==b)
    {
      if (!__builtin_constant_p (a==b))
	abort ();
      return 0;
    }
  else
    abort ();
}