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

[Fuzz] Raise error when entity aspect is missing in configuration specification. #1092

Merged
merged 1 commit into from
Dec 12, 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
4 changes: 4 additions & 0 deletions src/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -9076,7 +9076,11 @@ static void p_configuration_specification(tree_t parent)

push_scope(nametab);

bool is_open = (peek() == tUSE && peek_nth(2) == tOPEN);
tree_t bind = p_binding_indication(comp);
if (!is_open && bind == NULL)
parse_error(CURRENT_LOC, "a binding indication in an explicit "
"configuration specification must contain an entity aspect");
consume(tSEMI);

if (ids != NULL) {
Expand Down
12 changes: 12 additions & 0 deletions test/parse/config.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,15 @@ configuration use_pack_ent of ent is
end for;
end for;
end configuration;

entity b is
end entity b;

architecture rtl of b is
component ent
end component;

for ent0 : ent; -- Error
begin
ent0: ent;
end architecture rtl;
12 changes: 12 additions & 0 deletions test/test_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -2900,6 +2900,8 @@ START_TEST(test_config)
{ 45, "cannot find architecture BAD of entity WORK.ENT" },
{ 52, "P is not a block that can be configured" },
{ 55, "instance P not found" },
{ 85, "a binding indication in an explicit configuration "
"specification must contain an entity aspect" },
{ -1, NULL }
};
expect_errors(expect);
Expand Down Expand Up @@ -2979,6 +2981,16 @@ START_TEST(test_config)
fail_unless(tree_kind(c) == T_CONFIGURATION);
lib_put(lib_work(), c);

e = parse();
fail_if(e == NULL);
fail_unless(tree_kind(e) == T_ENTITY);
lib_put(lib_work(), e);

e = parse();
fail_if(e == NULL);
fail_unless(tree_kind(e) == T_ARCH);
lib_put(lib_work(), e);

c = parse();
fail_unless(c == NULL);

Expand Down
Loading