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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [c99-array-lval-8.c] - Blame information for rev 826

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* Test for non-lvalue arrays: test that qualifiers on non-lvalues
2
   containing arrays do not remain when those arrays decay to
3
   pointers.  PR 35235.  */
4
/* { dg-do compile } */
5
/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
6
 
7
int a;
8
 
9
void
10
f (void)
11
{
12
  const struct {
13
    int a[1];
14
  } s;
15
  int *p1 = s.a; /* { dg-error "qualifiers" } */
16
  int *p2 = (a ? s : s).a;
17
  /* In this case, the qualifier is properly on the array element type
18
     not on the rvalue structure and so is not discarded.  */
19
  struct {
20
    const int a[1];
21
  } t;
22
  int *p3 = t.a; /* { dg-error "qualifiers" } */
23
  int *p4 = (a ? t : t).a; /* { dg-error "qualifiers" } */
24
  /* The issue could also lead to code being wrongly accepted.  */
25
  const struct {
26
    int a[1][1];
27
  } u;
28
  const int (*p5)[1] = u.a;
29
  const int (*p6)[1] = (a ? u : u).a; /* { dg-error "pointer" } */
30
}

powered by: WebSVN 2.1.0

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