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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [Wstrict-aliasing-bogus-ref-all.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2 -Wall" } */
3
 
4
struct g { long a; };
5
unsigned long f(struct g *a) { return *(unsigned long *)&a->a; }
6
 
7
struct A
8
{
9
  void *a;
10
};
11
 
12
int g(const struct A *x, long *y)
13
{
14
  typedef long __attribute__ ((may_alias)) long_a;
15
  *y = *(const long_a *) (&x->a);
16
  return 1;
17
}
18
 
19
void *a;
20
 
21
int
22
f0 (long *y)
23
{
24
  *y = *(const long *) &a; /* { dg-warning "will break" } */
25
  return 1;
26
}
27
 
28
int
29
f1 (long *y)
30
{
31
  typedef long __attribute__ ((may_alias)) long_a;
32
  *y = *(const long_a *) &a;
33
  return 1;
34
}
35
 
36
int
37
f2 (long *y)
38
{
39
  *y = *(const long *) &a; /* { dg-warning "will break" } */
40
  return 1;
41
}

powered by: WebSVN 2.1.0

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