Skip to content

Commit

Permalink
Fix seg fault at initalization in debug mode
Browse files Browse the repository at this point in the history
When using gcc 4.8 on centos7, with debug compile, in a certain app, we
get core dumps involving SIGSEGV in __memcmp_sse4_1 deep inside
operator[](std::string&&).

We don't understand it, and in fact suspect a compiler bug. Can't
reproduce on other platforms or compiler releases. Sweep it under the
rug with this patch, that seems to work around it, though we admit we
don't know why.
  • Loading branch information
J Robert Ray authored and lgritz committed Nov 29, 2016
1 parent 3f6a526 commit 5fb34ec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/libOpenImageIO/exif.cpp
Expand Up @@ -280,8 +280,14 @@ class TagMap {
for (int i = 0; tag_table[i].tifftag >= 0; ++i) {
const EXIF_tag_info *eti = &tag_table[i];
m_tagmap[eti->tifftag] = eti;
if (eti->name)
m_namemap[eti->name] = eti;
if (eti->name) {
// m_namemap[eti->name] = eti leads to segfault at
// initialization in debug build on rhel7. This two-step
// process Seems to work. We have no idea why. Maybe gcc
// 4.8 compiler bug?
std::string key = eti->name;
m_namemap[key] = eti;
}
}
}

Expand Down

0 comments on commit 5fb34ec

Please sign in to comment.