gcc 4.4.1 produces different code for these equivalent inputs. optimization levels -Os -O2 -O3
It'd be good if the produced code were identical. #include <stdio.h> #include <stdlib.h> #include <stdbool.h> int main(int argc, char** argv) { _Bool foo; _Bool bar; foo = !!rand(); bar = !!rand(); foo &= bar; printf("%u %u\n", foo, bar); foo = !!rand(); bar = !!rand(); foo = foo & bar; printf("%u %u\n", foo, bar); foo = !!rand(); bar = !!rand(); foo = foo && bar; printf("%u %u\n", foo, bar); return 0; } -- Summary: _Bool foo &= bar; vs _Bool foo = foo && bar; vs _Bool foo = foo & bar; emitted code different Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: joe at perches dot com GCC build triplet: i486-linux-gnu GCC host triplet: i486-linux-gnu GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42382