整数値が、負の量または値に含まれるビット数以上の量だけシフトされるように指定され、予期せぬ結果または不確定な結果を引き起こす。
負の量だけシフトする値を指定することは、さまざまな言語で未定義である。さまざまなコンピュータ・アーキテクチャが、さまざまな方法でこの動作を実装している。シフトを行うコードを生成するコンパイラやインタープリタは、一般にこの問題のチェックを行わない。
オーバーシフト(シフトされる値に含まれるビット数以上のシフト)を指定すると、アーキテクチャーやコンパイラーによって異なる結果が得られる。一部の言語では、この動作は未定義の結果を生成すると明記されています。
An integer value is specified to be shifted by a negative amount or an amount greater than or equal to the number of bits contained in the value causing an unexpected or indeterminate result.
Specifying a value to be shifted by a negative amount is undefined in various languages. Various computer architectures implement this action in different ways. The compilers and interpreters when generating code to accomplish a shift generally do not do a check for this issue.
Specifying an over-shift, a shift greater than or equal to the number of bits contained in a value to be shifted, produces a result which varies by architecture and compiler. In some languages, this action is specifically listed as producing an undefined result.