URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 298 |
Rev 338 |
/* PR tree-optimization/33136 */
|
/* PR tree-optimization/33136 */
|
/* { dg-do run } */
|
/* { dg-do run } */
|
/* { dg-options "-O2" } */
|
/* { dg-options "-O2" } */
|
|
|
extern void abort (void);
|
extern void abort (void);
|
|
|
struct S
|
struct S
|
{
|
{
|
void *a;
|
void *a;
|
int b;
|
int b;
|
int *c;
|
int *c;
|
};
|
};
|
static int d, e;
|
static int d, e;
|
|
|
static struct S s;
|
static struct S s;
|
|
|
static int *
|
static int *
|
__attribute__((noinline, const))
|
__attribute__((noinline, const))
|
foo (void)
|
foo (void)
|
{
|
{
|
return &s.b;
|
return &s.b;
|
}
|
}
|
|
|
int *
|
int *
|
__attribute__((noinline))
|
__attribute__((noinline))
|
bar (int **f)
|
bar (int **f)
|
{
|
{
|
s.c = &d;
|
s.c = &d;
|
*f = &e;
|
*f = &e;
|
/* As nothing ever takes the address of any int * field in struct S,
|
/* As nothing ever takes the address of any int * field in struct S,
|
the write to *f can't alias with the s.c field. */
|
the write to *f can't alias with the s.c field. */
|
return s.c;
|
return s.c;
|
}
|
}
|
|
|
int
|
int
|
__attribute__((noinline))
|
__attribute__((noinline))
|
baz (int *x)
|
baz (int *x)
|
{
|
{
|
s.b = 1;
|
s.b = 1;
|
*x = 4;
|
*x = 4;
|
/* Function foo takes address of an int field in struct S,
|
/* Function foo takes address of an int field in struct S,
|
so *x can alias with the s.b field (and it does in this testcase). */
|
so *x can alias with the s.b field (and it does in this testcase). */
|
return s.b;
|
return s.b;
|
}
|
}
|
|
|
int
|
int
|
__attribute__((noinline))
|
__attribute__((noinline))
|
t (void)
|
t (void)
|
{
|
{
|
int *f = (int *) 0;
|
int *f = (int *) 0;
|
return 10 * (bar (&f) != &d) + baz (foo ());
|
return 10 * (bar (&f) != &d) + baz (foo ());
|
}
|
}
|
|
|
int
|
int
|
main (void)
|
main (void)
|
{
|
{
|
if (t () != 4)
|
if (t () != 4)
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.