https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90110
--- Comment #6 from rguenther at suse dot de <rguenther at suse dot de> --- On Wed, 17 Apr 2019, ian at airs dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90110 > > --- Comment #4 from Ian Lance Taylor <ian at airs dot com> --- > Thanks for the file. Unfortunately it looks fine. > > The error is coming from Import_function_body::read_type in > gcc/go/gofrontend/import.cc. At the point of the error this->body_ + > this->off_ points to a string starting with "<type 4>,". The function starts > like this: > > this->require_c_string("<type "); > size_t start = this->off_; > size_t i; > int c = '\0'; > for (i = start; i < this->body_.length(); ++i) > { > c = static_cast<unsigned char>(this->body_[i]); > if (c != '-' && (c < '0' || c > '9')) > break; > } > this->off_ = i + 1; > > char *end; > long val = strtol(this->body_.substr(start, i - start).c_str(), &end, 10); Just a wild guess - does this->body_.substr(start, i - start).c_str() really live until after strtol has completed? IIRC I saw this kind of errors in other codes... since the temporary std::string isn't passed to the function it should be destroyed. Assuming this->body_ is a std::string, of course. Using profiledbootstrap might just expose this "issue" I guess. Trying whether Index: gcc/go/gofrontend/import.cc =================================================================== --- gcc/go/gofrontend/import.cc (revision 270403) +++ gcc/go/gofrontend/import.cc (working copy) @@ -1478,7 +1478,8 @@ Import_function_body::read_type() this->off_ = i + 1; char *end; - long val = strtol(this->body_.substr(start, i - start).c_str(), &end, 10); + std::string subs = this->body_.substr(start, i - start); + long val = strtol(subs.c_str(), &end, 10); if (*end != '\0' || i > 0x7fffffff) { if (!this->saw_error_) fixes the issue for me (will report back tomorrow). Just in case this is indeed an obvious error feel free to fix faster than that ;)