Use of an uninitialized variable
Signed integer overflow
Oversized Shift Amounts
Dereferences of Wild Pointers and Out of Bounds Array Accesses
Dereferencing a NULL Pointer
Violating Type Rules
At least, Specification(*2) doesn't contain a word "undefined".
*1 http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html
*2 http://golang.org/doc/go_spec.html
--
Takashi Kawachi
tkawachi at gmail.com
Should I file a doc bug?
kr
All variables are initialized to a "zero" value that is defined by the spec.
> Signed integer overflow
The result wraps around.
> Oversized Shift Amounts
There is no such thing in Go.
> Dereferences of Wild Pointers and Out of Bounds Array Accesses
It's not possible to have a wild pointer unless you use the package
unsafe (or you're using a buggy package which uses unsafe). However,
once unsafe is used the results are not well-defined, but it should be
obvious when it's happening in your own code.
If a slice or array index out of bounds, a run-time panic occurs.
> Dereferencing a NULL Pointer
You mean "nil". ;) This is undefined in the spec, but I suspect the
spec should say it causes a run-time panic. That's what the runtimes
do right now.
> Violating Type Rules
Go doesn't allow this without using the package unsafe.
- Evan
--