Merge pull request #1476 from KLayout/issue-1474

Fixing issue-1474 (throw a FATAL ERROR when multiple cellname have th…
This commit is contained in:
Matthias Köfferlein 2023-09-12 07:22:37 +02:00 committed by GitHub
commit 70dcef25ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -150,11 +150,11 @@ CommonReaderBase::rename_cell (db::Layout &layout, size_t id, const std::string
std::map<size_t, std::pair<std::string, db::cell_index_type> >::iterator iid = m_id_map.find (id);
std::map<std::string, std::pair<size_t, db::cell_index_type> >::iterator iname = m_name_map.find (cn);
if (iid != m_id_map.end () && iname != m_name_map.end ()) {
if (iid != m_id_map.end () && ! iid->second.first.empty () && iid->second.first != cn) {
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 (! iid->second.first.empty () && iid->second.first != cn) {
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 (iid != m_id_map.end () && iname != m_name_map.end ()) {
if (iname->second.second != iid->second.second) {

View File

@ -584,3 +584,18 @@ TEST(Bug_121_2)
std::string fn_au (tl::testdata () + "/oasis/bug_121_au2.gds");
db::compare_layouts (_this, layout, fn_au, db::WriteGDS2, 1);
}
TEST(Bug_1474)
{
db::Manager m (false);
db::Layout layout (&m);
try {
tl::InputStream file (tl::testdata_private () + "/oasis/issue_1474.oas");
db::OASISReader reader (file);
reader.read (layout);
EXPECT_EQ (false, true);
} catch (tl::Exception &ex) {
EXPECT_EQ (ex.msg (), "Cell named ADDHX2 with ID 4 was already given name SEDFFTRX2 (position=763169, cell=)");
}
}