http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57555 --- Comment #1 from Ari Sundholm <megari at mbnet dot fi> --- It seems that actually just making the variable const suffices: uint8_t foo() { static const uint8_t foo = 0xff; uint8_t ret = ~foo; return ret; }