aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/lvalue-cast-1.c
blob: e434baf6e7e0628ae33f340bc7eb4ae3659558a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* APPLE LOCAL file non lvalue assign */
/* { dg-do compile } */
/* { dg-options "-fnon-lvalue-assign -faltivec" } */

int foo(void) {

  char *p;
  long l;
  short s;
  vector unsigned int vui;
  volatile int *pvi;

  (long *)p = &l; /* { dg-warning "target of assignment not really an lvalue" } */
  ((long *)p)++;  /* { dg-warning "target of assignment not really an lvalue" } */
  (short)l = 2;   /* { dg-error "invalid lvalue" } */
  (long)s = 3;    /* { dg-error "invalid lvalue" } */
  (int)pvi = 4;   /* { dg-warning "target of assignment not really an lvalue" } */
  (int)pvi &= 5;  /* { dg-warning "target of assignment not really an lvalue" } */

  (vector float)vui = (vector float)(1.0, 2.0, 3.0, 4.0); /* { dg-warning "target of assignment not really an lvalue" } */

  return 0;
}