The code would attempt to add a new signature to the ir_function, which
didn't exist. Simply bailing out/returning early seems reasonable.
Fixes piglit test redeclaration-02.vert, and fixes a crash in
redeclaration-03.vert (the test still fails).
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state, "function `%s' redefined", name);
YYLTYPE loc = this->get_location();
_mesa_glsl_error(& loc, state, "function `%s' redefined", name);
}
}
} else if (state->symbols->name_declared_this_scope(name)) {
}
}
} else if (state->symbols->name_declared_this_scope(name)) {
_mesa_glsl_error(& loc, state, "function name `%s' conflicts with "
"non-function", name);
_mesa_glsl_error(& loc, state, "function name `%s' conflicts with "
"non-function", name);
} else {
f = new(ctx) ir_function(name);
state->symbols->add_function(f->name, f);
} else {
f = new(ctx) ir_function(name);
state->symbols->add_function(f->name, f);
prototype->hir(instructions, state);
ir_function_signature *signature = prototype->signature;
prototype->hir(instructions, state);
ir_function_signature *signature = prototype->signature;
+ if (signature == NULL)
+ return NULL;
assert(state->current_function == NULL);
state->current_function = signature;
assert(state->current_function == NULL);
state->current_function = signature;