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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [c99-array-lval-8.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
/* 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 "qualifier" } */
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 "qualifier" } */
23
  int *p4 = (a ? t : t).a; /* { dg-error "qualifier" } */
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.