Because in debug mode, *(str+10) and the whole unused space have an initialized value '0', so it seems like it's 0 terminated.
bash-3.2$ clang -O0 t.c -o t #compile in debug mode
bash-3.2$ ./t
abcdefghij
bash-3.2$ clang -O2 t.c -o t #compile with optimization
bash-3.2$ ./t
abcdefghij2÷d=