diff --git a/gcc/gensupport.cc b/gcc/gensupport.cc
index b2feb03363aca93cf1d7101cc31ed6947905d154..f7164b3214d210c99cc11f7bc71096cd8a6987e1 100644
--- a/gcc/gensupport.cc
+++ b/gcc/gensupport.cc
@@ -640,7 +640,7 @@ public:
 
     name.assign (ns, len);
     if (numeric)
-      idx = std::stoi (name);
+      idx = strtol (name.c_str (), (char **)NULL, 10);
   }
 
   /* Adds a character to the end of the string.  */