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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [pr25682.c] - Blame information for rev 749

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

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

powered by: WebSVN 2.1.0

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