Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on warning of hidden declaration. Issue #1038 #1048

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Added a warning for potential infinite loops in processes without
sensitivity and lacking any wait statements (from @NikLeberg).
- Fixed a crash when `'last_value` is used with record types (#1043).
- Several other minor bugs were resolved (#1038).

## Version 1.14.1 - 2024-10-26
- Fixed an error when using the `work` library alias and the working
Expand Down
2 changes: 1 addition & 1 deletion src/names.c
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ static void warn_hidden_decl(scope_t *s, decl_t *outer, tree_t inner)
// to avoid false-positives and cases that may be intentional

for (scope_t *it = s; it && it != outer->origin; it = it->parent) {
if (s->container == NULL)
if (it->container == NULL)
return; // Ignore ports in component, etc.
else if (is_subprogram(it->container))
return; // Do not warn when subprogram parameters hide ports
Expand Down
11 changes: 11 additions & 0 deletions test/parse/issue1038.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package foo_pkg is
signal sig: integer;
end foo_pkg;

package body foo_pkg is
package bar_pkg is
signal sig: integer;
end bar_pkg;
package body bar_pkg is
end package body bar_pkg;
end package body foo_pkg;
16 changes: 16 additions & 0 deletions test/test_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -6912,6 +6912,21 @@ START_TEST(test_issue991)
}
END_TEST

START_TEST(test_issue1038)
{
opt_set_int(OPT_RELAXED, 1);
set_standard(STD_08);

input_from_file(TESTDIR "/parse/issue1038.vhd");

parse_and_check(T_PACKAGE, T_PACK_BODY);

fail_unless(parse() == NULL);

fail_if_errors();
}
END_TEST

Suite *get_parse_tests(void)
{
Suite *s = suite_create("parse");
Expand Down Expand Up @@ -7076,6 +7091,7 @@ Suite *get_parse_tests(void)
tcase_add_test(tc_core, test_issue961);
tcase_add_test(tc_core, test_issue977);
tcase_add_test(tc_core, test_issue991);
tcase_add_test(tc_core, test_issue1038);
suite_add_tcase(s, tc_core);

return s;
Expand Down
Loading