diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/lvalue-cast-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/lvalue-cast-1.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/lvalue-cast-1.c b/gcc/testsuite/gcc.dg/lvalue-cast-1.c new file mode 100644 index 00000000000..e434baf6e7e --- /dev/null +++ b/gcc/testsuite/gcc.dg/lvalue-cast-1.c @@ -0,0 +1,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; +} |