mirror of
https://github.com/cc65/cc65.git
synced 2025-01-26 17:36:57 +00:00
Fix a compiler crash that happens after a function definition with two or
more identical parameter names. The input is of course wrong, but the compiler shouldn't crash. git-svn-id: svn://svn.cc65.org/cc65/trunk@644 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
787ca6a9dd
commit
00706daa49
@ -561,10 +561,18 @@ static void callfunction (struct expent* lval)
|
||||
|
||||
/* Fetch the pointer to the next argument, check for too many args */
|
||||
if (ParamCount <= Func->ParamCount) {
|
||||
/* Beware: If there are parameters with identical names, they
|
||||
* cannot go into the same symbol table, which means that in this
|
||||
* case of errorneous input, the number of nodes in the symbol
|
||||
* table and ParamCount are NOT equal. We have to handle this case
|
||||
* below to avoid segmentation violations. Since we know that this
|
||||
* problem can only occur if there is more than one parameter,
|
||||
* we will just use the last one.
|
||||
*/
|
||||
if (ParamCount == 1) {
|
||||
/* First argument */
|
||||
Param = Func->SymTab->SymHead;
|
||||
} else {
|
||||
/* First argument */
|
||||
Param = Func->SymTab->SymHead;
|
||||
} else if (Param->NextSym != 0) {
|
||||
/* Next argument */
|
||||
Param = Param->NextSym;
|
||||
CHECK ((Param->Flags & SC_PARAM) != 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user