clash-lang / clash-compiler

Haskell to VHDL/Verilog/SystemVerilog compiler
https://clash-lang.org/
Other
1.43k stars 151 forks source link

PrimitiveGuard warnings are duplicated #2561

Closed leonschoorl closed 1 year ago

leonschoorl commented 1 year ago
$ cabal run -- clash --vhdl -itests/shouldwork/PrimitiveGuards WarnAlways  -fclash-no-cache
[..]
GHC: Compiling and loading modules took: 0.367s
Hint: interpreting "WarnAlways.primitiveTF"
Hint: Interpreting WarnAlways.primitiveTF
Clash: Parsing and compiling primitives took 1.186s
GHC+Clash: Loading modules cumulatively took 1.847s
Clash: Ignoring previously made caches
Clash: Compiling WarnAlways.topEntity
Clash: Normalization took 0.000s
[WARNING] Dubious primitive instantiation for WarnAlways.primitive: You shouldn't use 'primitive'! (disable with -fclash-no-prim-warn)
[WARNING] Dubious primitive instantiation for WarnAlways.primitive: You shouldn't use 'primitive'! (disable with -fclash-no-prim-warn)
Clash: Netlist generation took 0.000s
Clash: Compiling WarnAlways.topEntity took 0.005s
Clash: Total compilation took 1.853s

WarnAlways.primitive is only used once, but its warning gets reported twice.

Some bisecting reports that this duplication was introduced by c8f2bbdc1147be678c6cbda3832aec7f01a96be0

leonschoorl commented 1 year ago

This also holds for the warnings generated by checkPrimitive