--- /dev/null
+From 84a7bf8585c500572a8ad19f9458f31d34abbcdc Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Tue, 28 Aug 2018 12:01:07 -0400
+Subject: [PATCH] Rewrite vernum function
+
+Fixes: https://github.com/skvadrik/re2c/issues/211
+---
+ re2c/src/conf/msg.cc | 27 +++++++++++++--------------
+ 1 file changed, 13 insertions(+), 14 deletions(-)
+
+--- a/src/conf/msg.cc
++++ b/src/conf/msg.cc
+@@ -102,23 +102,22 @@ void usage()
+ void vernum ()
+ {
+ std::string vernum (PACKAGE_VERSION);
+- if (vernum[1] == '.')
+- {
+- vernum.insert(0, "0");
+- }
+- vernum.erase(2, 1);
+- if (vernum[3] == '.')
+- {
+- vernum.insert(2, "0");
+- }
+- vernum.erase(4, 1);
+- if (vernum.length() < 6 || vernum[5] < '0' || vernum[5] > '9')
++ std::string parts[3];
++ unsigned p = 0;
++
++ for (unsigned i = 0; p < 3 && i < vernum.length (); i++)
+ {
+- vernum.insert(4, "0");
++ if (vernum[i] == '.')
++ p++;
++ else
++ parts[p].push_back (vernum[i]);
+ }
+- vernum.resize(6, '0');
+
+- printf ("%s\n", vernum.c_str ());
++ for (p = 0; p < 3; p++)
++ while (parts[p].length () < 2)
++ parts[p].insert (0, 1, '0');
++
++ printf ("%s%s%s\n", parts[0].c_str (), parts[1].c_str (), parts[2].c_str ());
+ }
+
+ void version ()