diff --git a/src/db/db/dbCommonReader.cc b/src/db/db/dbCommonReader.cc index 64eb1d85f..c184501e9 100644 --- a/src/db/db/dbCommonReader.cc +++ b/src/db/db/dbCommonReader.cc @@ -154,6 +154,10 @@ CommonReaderBase::rename_cell (db::Layout &layout, size_t id, const std::string common_reader_error (tl::sprintf (tl::to_string (tr ("Cell named %s with ID %ld was already given name %s")), cn, id, iid->second.first)); } + if (iname != m_name_map.end () && iname->second.first != null_id && iname->second.first != id) { + common_reader_error (tl::sprintf (tl::to_string (tr ("Same cell name %s, but different IDs: %ld and %ld")), cn, id, iname->second.first)); + } + if (iid != m_id_map.end () && iname != m_name_map.end ()) { if (iname->second.second != iid->second.second) { diff --git a/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc b/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc index d8b0d6c07..96f87436f 100644 --- a/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc +++ b/src/plugins/streamers/oasis/unit_tests/dbOASISReaderTests.cc @@ -599,3 +599,21 @@ TEST(Bug_1474) EXPECT_EQ (ex.msg (), "Cell named ADDHX2 with ID 4 was already given name SEDFFTRX2 (position=763169, cell=)"); } } + +TEST(DuplicateCellname) +{ + db::Manager m (false); + db::Layout layout (&m); + + try { + tl::InputStream file (tl::testdata () + "/oasis/duplicate_cellname.oas"); + db::OASISReader reader (file); + reader.read (layout); + EXPECT_EQ (false, true); + } catch (tl::CancelException &ex) { + // Seen when private test data is not installed + throw; + } catch (tl::Exception &ex) { + EXPECT_EQ (ex.msg (), "Same cell name TOP, but different IDs: 3 and 0 (position=1070, cell=)"); + } +} diff --git a/testdata/oasis/duplicate_cellname.oas b/testdata/oasis/duplicate_cellname.oas new file mode 100644 index 000000000..0ce5df921 Binary files /dev/null and b/testdata/oasis/duplicate_cellname.oas differ