vhdl-mode is using function 'comment-region' from the
‘newcomment.el’ package. With the default value of 1 for option
'comment-padding' the comment string "-- " is inserted, resulting in
-- -- this is a test comment -- library ieee; -- use ieee.std_logic_1164.all
for which uncommenting works fine. You might have changed
'comment-padding' to 0, which is when you get
---- this is a test comment --library ieee; --use ieee.std_logic_1164.all
For this, 'comment-region' doesn't work correctly for languages with
comment starts that contain 2 of the same characters, like "--" in
VHDL or "//" in C++. C++-mode doesn't honor the 'comment-padding'
option though and always inserts "// ", so the problem doesn't
occur.