aboutsummaryrefslogtreecommitdiff
path: root/gcc/c/c-decl.cc
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@gmail.com>2023-10-14 13:40:05 -0700
committerAndrew Pinski <pinskia@gmail.com>2023-10-18 15:11:39 -0700
commit879c91fcccf93681bd7e13290bfbb384cadcd268 (patch)
treeb38718f51a2ed6b348f1b813a149a6cb382d5aec /gcc/c/c-decl.cc
parent11e6bcedb41359c69ee790f38b04033d236336a8 (diff)
downloadgcc-879c91fcccf93681bd7e13290bfbb384cadcd268.zip
gcc-879c91fcccf93681bd7e13290bfbb384cadcd268.tar.gz
gcc-879c91fcccf93681bd7e13290bfbb384cadcd268.tar.bz2
[c] Fix PR 101364: ICE after error due to diagnose_arglist_conflict not checking for error
When checking to see if we have a function declaration has a conflict due to promotations, there is no test to see if the type was an error mark and then calls c_type_promotes_to. c_type_promotes_to is not ready for error_mark and causes an ICE. This adds a check for error before the call of c_type_promotes_to. OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR c/101364 gcc/c/ChangeLog: * c-decl.cc (diagnose_arglist_conflict): Test for error mark before calling of c_type_promotes_to. gcc/testsuite/ChangeLog: * gcc.dg/pr101364-1.c: New test.
Diffstat (limited to 'gcc/c/c-decl.cc')
-rw-r--r--gcc/c/c-decl.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
index 0de3847..7a145be 100644
--- a/gcc/c/c-decl.cc
+++ b/gcc/c/c-decl.cc
@@ -1899,7 +1899,8 @@ diagnose_arglist_conflict (tree newdecl, tree olddecl,
break;
}
- if (c_type_promotes_to (type) != type)
+ if (!error_operand_p (type)
+ && c_type_promotes_to (type) != type)
{
inform (input_location, "an argument type that has a default "
"promotion cannot match an empty parameter name list "