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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [pr40946.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* PR middle-end/40946 */
2
/* { dg-do compile } */
3
/* { dg-options "-O2 -Wall" } */
4
 
5
struct A
6
{
7
  unsigned char a1[8];
8
  unsigned short a2, a3, a4, a5, a6, a7;
9
};
10
 
11
int bar (void *, const char *, int);
12
char *foo (void *, int);
13
 
14
char *
15
baz (const char *x, const char *y)
16
{
17
  int a = sizeof (struct A) + 2 * (__builtin_strlen (y)
18
                                   + __builtin_strlen (x) + 24) + 16;
19
  struct A *b = __builtin_malloc (a);
20
  char *c;
21
  int d;
22
 
23
  b->a4 = sizeof (struct A);
24
  c = ((char *) b) + b->a4;
25
  d = ((char *) b) + a - c;
26
  b->a2 = b->a3 = (unsigned short) bar (c, y, d); /* { dg-bogus "array subscript is above array bounds" } */
27
  c += b->a2;
28
  d = ((char *) b) + a - c;
29
  b->a7 = b->a4 + b->a2;
30
  b->a5 = b->a6 = (unsigned short) bar (c, x, d);
31
  c = foo (b, a);
32
  return c;
33
}

powered by: WebSVN 2.1.0

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