https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88895
--- Comment #4 from Scott <scott.a.mayo at gmail dot com> --- Um... yes, that would kill the warning; but then I'd be writing /* The modulo operation is meaningless and will be optimized out, I promise. It's here because there's a specific compiler, g++ 7.3.0, that can't figure out that the code is unreachable, and then generates freaky warnings over it. The only way known to shut up g++ without turning off the warning entirely is to do the modulo, which is harmless for code that's kept and doesn't matter in code that's discarded. */ No. I work with people who will rightly complain about a meaningless operator. As a workaround it's cute, but it's not going to pass code review and it should not need to be there. On 1/17/19 12:19 PM, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88895 > > Jakub Jelinek <jakub at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |jakub at gcc dot gnu.org > > --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > So just write it so that you don't invoke UB even there? > Like case 8: tobyte[sizeof(T) - 8] = (unsigned char)(v >> (56 % (sizeof(T) * > 8))); > ? >