Re: [PATCH] FIX PR114618 Format produces incorrect output when contains 1x

Harald Anlauf <[email protected]> Sun, 21 Jun 2026 22:09:24 +0200
Newsgroups gmane.comp.gcc.patches,gmane.comp.gcc.fortran
Message-ID <[email protected]>
Hi Jerry!

Am 21.06.26 um 5:24 AM schrieb Jerry D:
> See attached. Honestly I stared at this for hours and gave up on it more 
> than once since the problem first showed up. As usual, once one sees it, 
> it is almost obvious.
> 
> Feel free to exercise this thing since the area of tabbing has been so 
> troublesome.
> 
> Regression tested on x86_64.
> 
> OK for mainline?

I have only lightly tested it, but did not see any issue here.
So OK from my side.

Thanks for the patch!

Harald

> Regards,
> 
> Jerry
> 
> ---
> 
> libfortran: [PR114618] Format produces incorrect output when contains 1x
> 
>      When tabbing left or right it is possible to land in the format buffer
>      where some text is over written or skipped improperly. The bad 
> formatting
>      depended on whether stream I/O is used or regular I/O. The max 
> position
>      has to be calculated correctly in these situations.
> 
>      One existing test case is renamed to align with other format T/TL/TR
>      test cases.
> 
>              PR libfortran/114618
> 
>      libgfortran/ChangeLog:
> 
>              * io/transfer.c (formatted_transfer_scalar_write): Determine
>              possible new max_pos based on file I/O method and adjust
>              accordingly
> 
>      gcc/testsuite/ChangeLog:
> 
>              * gfortran.dg/pr114618.f90: Move to...
>              * gfortran.dg/fmt_t_10.f90: ...here.
>              * gfortran.dg/fmt_t_11.f90: New test.
> 
>