Skip to content

Instantly share code, notes, and snippets.

@ridiculousfish
Last active December 25, 2015 18:09
Show Gist options
  • Save ridiculousfish/7017899 to your computer and use it in GitHub Desktop.
Save ridiculousfish/7017899 to your computer and use it in GitHub Desktop.
clang UBSan test case fails at -O1 and above
#include <string>
struct obj1_t
{
std::string text;
int val;
};
struct obj2_t
{
int val;
char padding[16];
};
struct obj3_t
{
int field1;
int field2;
long long aligner;
void func(obj2_t obj2, int param, ...)
{
this->field1 = true;
if (param && this->field2)
{
obj1_t obj1;
obj1.val = obj2.val;
}
}
};
int main(void)
{
obj2_t obj;
obj3_t p;
p.func(obj, 0);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment