------- Comment #1 from rguenth at gcc dot gnu dot org 2009-08-01 14:58 ------- This is because of the differences in the IL C vs. C++.
C has r0 = (short unsigned int) *pcr - (short unsigned int) *ppr; r1 = (short unsigned int) *pcg - (short unsigned int) *ppg; r2 = (short unsigned int) *pcb - (short unsigned int) *ppb; r0 = (r0 >> 8 | 65280) & r0; r1 = (r1 >> 8 | 65280) & r1; r2 = (r2 >> 8 | 65280) & r2; short unsigned int r = (r0 + r1) + r2; *n = (*n + r) - (*n >> 5); *o = (unsigned char) r; while C++ does (EH stuff stripped): r0 = (short unsigned int) *(unsigned char *) pcr - (short unsigned int) *(unsigned char *) ppr; r1 = (short unsigned int) *(unsigned char *) pcg - (short unsigned int) *(unsigned char *) ppg; r2 = (short unsigned int) *(unsigned char *) pcb - (short unsigned int) *(unsigned char *) ppb; r0 = (short unsigned int) (((short int) ((int) r0 >> 8) | -256) & (short int) r0); r1 = (short unsigned int) (((short int) ((int) r1 >> 8) | -256) & (short int) r1); r2 = (short unsigned int) (((short int) ((int) r2 >> 8) | -256) & (short int) r2); r = (r0 + r1) + r2; *(short unsigned int *) n = (*(short unsigned int *) n + r) - (short unsigned int) ((int) *(short unsigned int *) n >> 5); *(unsigned char *) o = (unsigned char) r; which looks unfolded compared to what C ends up with (the C FE shortens the BIT_IOR_EXPR to unsigned short, something fold should do instead). -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2009-08-01 14:58:34 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40927