https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81395

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #3)
> This started in 4.6.0 with r87453

It did start with 4.6.0 but that commit was already in 4.5.4 so it can't have
been that one. It seems to be the change to overflow in r164529 i.e. the fix
for PR 45628, which did this to basic_filebuf::overflow, introducing the
potential recursion:

@@ -410,8 +426,16 @@
       int_type __ret = traits_type::eof();
       const bool __testeof = traits_type::eq_int_type(__c, __ret);
       const bool __testout = _M_mode & ios_base::out;
-      if (__testout && !_M_reading)
+      if (__testout)
        {
+          if (_M_reading)
+            {
+              _M_destroy_pback();
+              const int __gptr_off = _M_get_ext_pos(_M_state_last);
+              if (_M_seek(__gptr_off, ios_base::cur, _M_state_last)
+                  == pos_type(off_type(-1)))
+                return __ret;
+            }
          if (this->pbase() < this->pptr())
            {
              // If appropriate, append the overflow char.

Reply via email to