Skip to content

Commit

Permalink
Fix crash in overload check of invalid alias declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
NikLeberg committed Jan 4, 2025
1 parent 1fa2af3 commit 9214724
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/names.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ static symbol_t *make_visible(scope_t *s, ident_t name, tree_t decl,
return sym;
}
else if (overload && kind == DIRECT && type != NULL
&& tree_has_type(dd->tree)
&& type_eq(type, tree_type(dd->tree))) {
if (dd->origin != s) {
// LRM 93 section 10.3 on visibility specifies that if two
Expand Down
6 changes: 6 additions & 0 deletions test/parse/alias5.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@ package test_pkg is
alias alias_t is type_t;
constant c : alias_t;
end package;

package pack is
procedure proc;
alias proc_alias is x;
alias proc_alias is proc [integer];
end package;
4 changes: 3 additions & 1 deletion test/test_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -7096,11 +7096,13 @@ START_TEST(test_alias5)

const error_t expect[] = {
{ 2, "no visible declaration for TYPE_T" },
{ 9, "no visible declaration for X" },
{ 10, "no visible subprogram PROC matches signature [INTEGER]" },
{ -1, NULL }
};
expect_errors(expect);

parse_and_check(T_PACKAGE);
parse_and_check(T_PACKAGE, T_PACKAGE);

fail_unless(parse() == NULL);

Expand Down

0 comments on commit 9214724

Please sign in to comment.