extern "C" void abort(void); unsigned bar(void) { return 32768;} void foobar (unsigned u) { if (u != (32768 | 65536)) abort (); } const char *name (void) { return "QPopupMenu"; } int main() { unsigned nStyle = bar (); const char *pClassName = name (); if (__builtin_strcmp ("QPopupMenu", pClassName) == 0) { bool is_enabled = bool (nStyle & 1); if (nStyle & 32768) nStyle |= 65536; foobar(nStyle); } return 0; }
is miscompiled at -O1 and -O2 on ppc32 (ppc64 is ok). -- Summary: Miscompiles bit test / set in OpenOffice Product: gcc Version: 4.1.2 Status: UNCONFIRMED Keywords: wrong-code Severity: blocker Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rguenth at gcc dot gnu dot org GCC target triplet: powerpc32-*-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29797