diff options
author | Andrew Pinski <pinskia@gmail.com> | 2023-10-14 13:18:00 -0700 |
---|---|---|
committer | Andrew Pinski <pinskia@gmail.com> | 2023-10-18 15:11:38 -0700 |
commit | 11e6bcedb41359c69ee790f38b04033d236336a8 (patch) | |
tree | ac2032a72b9d8f36bc500b2f4642cb1562874833 /gcc/testsuite | |
parent | 3ec8ecb8e92faec889bc6f7aeac9ff59e82b4f7f (diff) | |
download | gcc-11e6bcedb41359c69ee790f38b04033d236336a8.zip gcc-11e6bcedb41359c69ee790f38b04033d236336a8.tar.gz gcc-11e6bcedb41359c69ee790f38b04033d236336a8.tar.bz2 |
Fix ICE due to c_safe_arg_type_equiv_p not checking for error_mark node
This is a simple error recovery issue when c_safe_arg_type_equiv_p
was added in r8-5312-gc65e18d3331aa999. The issue is that after
an error, an argument type (of a function type) might turn
into an error mark node and c_safe_arg_type_equiv_p was not ready
for that. So this just adds a check for error operand for its
arguments before getting the main variant.
OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.
PR c/101285
gcc/c/ChangeLog:
* c-typeck.cc (c_safe_arg_type_equiv_p): Return true for error
operands early.
gcc/testsuite/ChangeLog:
* gcc.dg/pr101285-1.c: New test.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/gcc.dg/pr101285-1.c | 10 |
1 files changed, 10 insertions, 0 deletions
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" } */ +} + |