------- Comment #4 from rguenth at gcc dot gnu dot org 2008-03-19 10:23 ------- This is a bug in the C frontend which does the increment on type char, not on the promoted type (I noticed that while fixing bitfield issues as well), code in question is in build_unary_op() and this way since forever.
Original dump as from the FE: ;; Function main (main) ;; enabled by -tree-original { char c; char c; c = 0; <D.1559>:; foo ((int) c); c++ ; goto <D.1559>; } I tried to fix this once but failed. Joseph - can you give this a shot? The FE should for all pre-/postincrements just emit the proper {( int res = x; x = (typeof x)((int)x + 1); res; )} with using TARGET_EXPR/COMPOUND_EXPRs as required. Note the C++ frontend has the same problem here, so transition that bug there once the C FE is fixed. Thanks. -- rguenth at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jsm28 at gcc dot gnu dot org Status|UNCONFIRMED |NEW Component|target |c Ever Confirmed|0 |1 Keywords| |wrong-code Priority|P3 |P1 Last reconfirmed|0000-00-00 00:00:00 |2008-03-19 10:23:48 date| | Target Milestone|--- |4.1.3 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35634