https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82658
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2017-10-24
Component|target |middle-end
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ok. So the issue is a FE one after all. With the C FE we have
volatile unsigned char val;
unsigned char local = val;
local = local >> 1;
val = local;
while the C++ FE preserves the widening from the integer promotion rules:
<<cleanup_point <<< Unknown tree: expr_stmt
(void) (local = (unsigned char) val) >>>>>;
<<cleanup_point <<< Unknown tree: expr_stmt
(void) (local = (unsigned char) ((int) local >> 1)) >>>>>;
<<cleanup_point <<< Unknown tree: expr_stmt
(void) (val = local) >>>>>;
and nothing in the middle-end shortens the right-shift operation.