Skip to content

Commit 1968fe8

Browse files
authored
Merge pull request #666 from diffblue/wire-redeclaration
Verilog: error on wire redeclaration
2 parents f25aad5 + 092d58c commit 1968fe8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
KNOWNBUG
2-
input_and_reg.v
1+
CORE
2+
wire_and_wire.v
33

4+
^file wire_and_wire\.v line 4: symbol `some_var' is already declared$
45
^EXIT=2$
56
^SIGNAL=0$
67
--
78
--
8-
The redeclaration must be errored.

src/verilog/verilog_elaborate.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,12 @@ void verilog_typecheckt::collect_symbols(const verilog_declt &decl)
433433
// This is ok for certain symbols, e.g., input/wire, output/reg.
434434
symbolt &osymbol = *result;
435435

436-
if(osymbol.type.id() == ID_code)
436+
if(osymbol.is_input || osymbol.is_output)
437+
{
438+
// wire + input is ok
439+
// wire + output is ok
440+
}
441+
else
437442
{
438443
throw errort().with_location(decl.source_location())
439444
<< "symbol `" << symbol.base_name << "' is already declared";

0 commit comments

Comments
 (0)