diff options
Diffstat (limited to 'gcc/testsuite/c-c++-common')
-rw-r--r-- | gcc/testsuite/c-c++-common/Waddress-1.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/Waddress-1.c b/gcc/testsuite/c-c++-common/Waddress-1.c new file mode 100644 index 00000000000..a5d128fd531 --- /dev/null +++ b/gcc/testsuite/c-c++-common/Waddress-1.c @@ -0,0 +1,15 @@ +/* PR c/69768 */ +/* { dg-do compile } */ +/* { dg-options "-Waddress" } */ + +static int e; + +int +foo () +{ + return "foo1" != (void *) 0 /* { dg-bogus "comparison with string literal results in unspecified behaviou?r" } */ + && "foo2" != (const char *) ((void *) 0) /* { dg-bogus "comparison with string literal results in unspecified behaviou?r" } */ + && "foo3" != (const char *) ((void *) (10 - 10)) /* { dg-bogus "comparison with string literal results in unspecified behaviou?r" } */ + && "foo4" != (const char *) ((void *) (&e - &e)) /* { dg-warning "comparison with string literal results in unspecified behaviou?r" "" { target c } } */ + && "foo5" != "foo6"; /* { dg-warning "comparison with string literal results in unspecified behaviou?r" } */ +} |