I think there's a missed-optimization bug in GCC. =========================== testcase1.cc =========================== struct my_number { unsigned number; my_number(unsigned i) : number(i) { } }; const struct my_number n(1); int main(void) { unsigned i, result = 1; for (i = 0; i < 18; i++) result &= n.number; return result; } =========================== testcase2.cc =========================== struct my_string { char string[10]; unsigned size; my_string(const char*); }; inline my_string::my_string(const char* str) { size = __builtin_strlen(str); __builtin_memcpy(string, str, size); } inline bool operator==(const my_string& str1, const my_string& str2) { return str1.size == str2.size && !__builtin_memcmp(str1.string, str2.string, str1.size); } const my_string s1("abcdef"); const my_string s2("abcdef"); int main(void) { bool result = true; for (int i = 0; i < 18; i++) result &= s1 == s2; return result; } ==================================================================== Should it be reported to Bugzilla?