Duplicate IDs in VCD files
Since the VCD file is plain text, it can consume a huge amount of memory, especially for large chips.  Therefore, it is of utmost importance to keep the file size as small as possible.  That is why multiple hierarchical path names which represent the same logical node share the same ID code in the VCD file.  A signal can have many different names through the hierarchy, but they all share the same logic value data and change times.  

Every waveform viewer software probably implements it differently, but each unique hierarchical path name is in some sort of hash table which points to a single ID.  The viewer makes all the signal names available to the user to ease debug.  When the user selects out[23] and o_prod[30] for viewing, the tool simply retrieves the same data for both signals and displays them.