------- Comment #5 from rguenth at gcc dot gnu dot org 2006-08-08 09:09 ------- Confirmed. The problem is probably latent on mainline. check_header is being miscompiled, -O -fno-loop-optimize2 -fno-loop-optimize -fno-branch-count-reg is enough to trigger the bug (i.e. no loop bug).
extern void abort(void); struct input_ty { unsigned char *buffer_position; unsigned char *buffer_end; }; int input_getc_complicated (struct input_ty *x) { return 0; } int check_header (struct input_ty *deeper) { unsigned len; for (len = 0; len < 6; len++) if (((deeper)->buffer_position < (deeper)->buffer_end ? *((deeper)->buffer_position)++ : input_getc_complicated((deeper))) < 0) return 0; return 1; } struct input_ty s; unsigned char b[6]; int main (void) { s.buffer_position = b; s.buffer_end = b + sizeof b; if (!check_header(&s)) return 1; if (s.buffer_position != s.buffer_end) abort(); return 0; } it looks like ifcvt messes up in pass 3 and puts the post-inc in the cond-exec block. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Component|middle-end |rtl-optimization Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2006-08-08 09:09:48 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28636