Is there a GCC warning that detects bit shift operations on signed types?
If I read the C++ ISO specification (sections 5.8.2 and 5.8.3) right, the right-shift of negative signed types is implementation specific and the left-shift undefined behaviour. Therefore I would like to find shift operations on signed types in our legacy source code which we compile with g++ 4.8.2. Unfortunately, I couldn't find such an option in the manual . I can for example compile this code with "g++ -Wall -Wextra -pedantic" without a warning: int si = -1; int left = si << 1; // -2 (multiplication by 2, sign is preserved) int right = si >> 1; // -1 (no change, only 1s) Can anyone tell me