https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98953
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-02-04
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. The bswap would be the place that detects similar cases but I think
it doesn't consider this case because the number is "incomplete" and because
the pass doesnt' consider PLUS_EXPR or MULT_EXPR AFAIR. Also it doesn't
handle non-obviously same bases gracefully.
The following works:
#include <stdint.h>
#include <stdlib.h>
int f(uint8_t *read, size_t abs)
{
return read[0] + (read[1] << 8);
}