URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
149 |
jeremybenn |
/* Test for non-lvalue arrays decaying to pointers: in C99 only.
|
2 |
|
|
Test various ways of producing non-lvalue arrays. */
|
3 |
|
|
/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
|
4 |
|
|
/* { dg-do compile } */
|
5 |
|
|
/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
|
6 |
|
|
|
7 |
|
|
struct s { char c[1]; };
|
8 |
|
|
struct s a, b, c;
|
9 |
|
|
int d;
|
10 |
|
|
|
11 |
|
|
void
|
12 |
|
|
bar (void)
|
13 |
|
|
{
|
14 |
|
|
char *t;
|
15 |
|
|
(d ? b : c).c[0]; /* { dg-bogus "warning" "warning in place of error" } */
|
16 |
|
|
(d, b).c[0]; /* { dg-bogus "warning" "warning in place of error" } */
|
17 |
|
|
(a = b).c[0]; /* { dg-bogus "warning" "warning in place of error" } */
|
18 |
|
|
t = (d ? b : c).c; /* { dg-bogus "warning" "warning in place of error" } */
|
19 |
|
|
t = (d, b).c; /* { dg-bogus "warning" "warning in place of error" } */
|
20 |
|
|
t = (a = b).c; /* { dg-bogus "warning" "warning in place of error" } */
|
21 |
|
|
(d ? b : c).c + 1; /* { dg-bogus "warning" "warning in place of error" } */
|
22 |
|
|
(d, b).c + 1; /* { dg-bogus "warning" "warning in place of error" } */
|
23 |
|
|
(a = b).c + 1; /* { dg-bogus "warning" "warning in place of error" } */
|
24 |
|
|
}
|
25 |
|
|
/* { dg-error "non-lvalue" "array not decaying to lvalue" { target *-*-* } 15 }
|
26 |
|
|
{ dg-error "non-lvalue" "array not decaying to lvalue" { target *-*-* } 16 }
|
27 |
|
|
{ dg-error "non-lvalue" "array not decaying to lvalue" { target *-*-* } 17 }
|
28 |
|
|
{ dg-error "non-lvalue|incompatible" "array not decaying to lvalue" { target *-*-* } 18 }
|
29 |
|
|
{ dg-error "non-lvalue|incompatible" "array not decaying to lvalue" { target *-*-* } 19 }
|
30 |
|
|
{ dg-error "non-lvalue|incompatible" "array not decaying to lvalue" { target *-*-* } 20 }
|
31 |
|
|
{ dg-error "non-lvalue|invalid" "array not decaying to lvalue" { target *-*-* } 21 }
|
32 |
|
|
{ dg-error "non-lvalue|invalid" "array not decaying to lvalue" { target *-*-* } 22 }
|
33 |
|
|
{ dg-error "non-lvalue|invalid" "array not decaying to lvalue" { target *-*-* } 23 }
|
34 |
|
|
*/
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.