diff options
-rw-r--r-- | gcc/c/c-typeck.cc | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr101285-1.c | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index e55e887..6e044b4 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -5960,6 +5960,9 @@ handle_warn_cast_qual (location_t loc, tree type, tree otype) static bool c_safe_arg_type_equiv_p (tree t1, tree t2) { + if (error_operand_p (t1) || error_operand_p (t2)) + return true; + t1 = TYPE_MAIN_VARIANT (t1); t2 = TYPE_MAIN_VARIANT (t2); diff --git a/gcc/testsuite/gcc.dg/pr101285-1.c b/gcc/testsuite/gcc.dg/pr101285-1.c new file mode 100644 index 0000000..831e35f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr101285-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-W -Wall" } */ +const int b; +typedef void (*ft1)(int[b++]); /* { dg-error "read-only variable" } */ +void bar(int * z); +void baz() +{ + (ft1) bar; /* { dg-warning "statement with no effect" } */ +} + |