[Bug c/88895] unnecessary -Wshift-count-overflow in unreachable code (shift)

2019-01-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88895 --- Comment #8 from Martin Sebor --- I agree that GCC would do a better by running -Wshift-count-overflow later (but that carries a risk of false positives as well). That's also why I acknowledged the report. Both solutions appear to be optimiz

[Bug c/88895] unnecessary -Wshift-count-overflow in unreachable code (shift)

2019-01-17 Thread scott.a.mayo at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88895 --- Comment #7 from Scott --- While that's brilliant, 1) I don't lack for ways to code around the problem, but whether or not I do, g++ nonetheless has a problem here. 2) At a guess, the recursive solution is avoiding the warnings because the

[Bug c/88895] unnecessary -Wshift-count-overflow in unreachable code (shift)

2019-01-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88895 --- Comment #6 from Martin Sebor --- The C++ solution to this kind of problem is to use template specialization. It's a been a while since I wrote any real C++ code but this seems to work and avoids the warnings class PackRule { template s

[Bug c/88895] unnecessary -Wshift-count-overflow in unreachable code (shift)

2019-01-17 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88895 --- Comment #5 from Marc Glisse --- (In reply to Martin Sebor from comment #2) > The warning is not specific to C++ but triggers for C code as well True, but C++ templates somehow make this different. In C, you could use the preprocessor to test

[Bug c/88895] unnecessary -Wshift-count-overflow in unreachable code (shift)

2019-01-17 Thread scott.a.mayo at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88895 --- Comment #4 from Scott --- 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 fig

[Bug c/88895] unnecessary -Wshift-count-overflow in unreachable code (shift)

2019-01-17 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88895 Martin Sebor changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill