Clear code range when modify/expanding string for IO.read(..,buf).

Fixes #2316.

Test added to MRI in http://mla.n-z.jp/~w3ml/w3ml.cgi/ruby-changes/msg/36766