OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr15262-1.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* PR 15262.
2
   The alias analyzer only considers relations between pointers and
3
   symbols.  If two pointers P and Q point to the same symbol S, then
4
   their respective memory tags will either be the same or they will
5
   have S in their alias set.
6
 
7
   However, if there are no common symbols between P and Q, TBAA will
8
   currently miss their alias relationship altogether.  */
9
struct A
10
{
11
  int t;
12
  int i;
13
};
14
 
15
int foo () { return 3; }
16
 
17
main ()
18
{
19
  struct A loc, *locp;
20
  float f, g, *p;
21
  int T355, *T356;
22
 
23
  /* Avoid the partial hack in TBAA that would consider memory tags if
24
     the program had no addressable symbols.  */
25
  f = 3;
26
  g = 2;
27
  p = foo () ? &g : &f;
28
  if (*p > 0.0)
29
    g = 1;
30
 
31
  /* Store into *locp and cache its current value.  */
32
  locp = malloc (sizeof (*locp));
33
  locp->i = 10;
34
  T355 = locp->i;
35
 
36
  /* Take the address of one of locp's fields and write to it.  */
37
  T356 = &locp->i;
38
  *T356 = 1;
39
 
40
  /* Read the recently stored value.  If TBAA fails, this will appear
41
     as a redundant load that will be replaced with '10'.  */
42
  T355 = locp->i;
43
  if (T355 != 1)
44
    abort ();
45
 
46
  return 0;
47
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.