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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [pr25682.c] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* PR c/25682 */
2
/* { dg-do compile } */
3
/* Test whether we don't ICE on questionable constructs where offsetof
4
   should have been used instead.  */
5
 
6
struct S
7
{
8
  char a[4];
9
  int b;
10
};
11
 
12
char c[(char *) &((struct S *) 0)->b - (char *) 0];
13
char d[(__SIZE_TYPE__) &((struct S *) 8)->b];
14
char e[sizeof (c) == __builtin_offsetof (struct S, b) ? 1 : -1];
15
char f[sizeof (d) == __builtin_offsetof (struct S, b) + 8 ? 1 : -1];
16
 
17
extern void bar (char *, char *);
18
 
19
void
20
foo (void)
21
{
22
  char g[(char *) &((struct S *) 0)->b - (char *) 0];
23
  char h[(__SIZE_TYPE__) &((struct S *) 8)->b];
24
  char i[sizeof (g) == __builtin_offsetof (struct S, b) ? 1 : -1];
25
  char j[sizeof (h) == __builtin_offsetof (struct S, b) + 8 ? 1 : -1];
26
  bar (g, h);
27
}

powered by: WebSVN 2.1.0

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