compiler: use temporary to avoid early destruction
compiler: use temporary to avoid early destruction

The code was passing a substr directly to strtol, and then checking
the *end value returned by strtol.  But the substr could be destroyed
as soon as strtol returns, making the test of *end invalid.

Also fix an incorrect test of the string index rather than the value.

Fixes https://gcc.gnu.org/PR90110

Change-Id: I020a26249ab00d5828621a0ec120e3f7c790df2e
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/172663
Reviewed-by: Than McIntosh <4b2922593166fc595a9b1a408f34f5d3817fe9d2@google.com>

golang/gofrontend,golang/gofrontend,golang/gofrontend,golang/gofrontend