[flang-commits] [PATCH] D128262: [Fortran] Avoid digits in character constant
Diana Picus via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Jun 23 06:06:56 PDT 2022
rovka added a comment.
In D128262#3604728 <https://reviews.llvm.org/D128262#3604728>, @awarzynski wrote:
> Hey Diana, cheers for looking into this!
>
> Please bear with me, as this is not my are of expertise :)
Not mine either :D
>> Test 9 from FM905.f tests the splitting of long character strings at the 80-character boundary when using list-directed output.
>
> Where is this boundary imposed? Is it a limit for the input of for the output? The get a better idea, I've run this benchmark using `flang-new` and `gfortran`:
>
> **flang-new**
>
> COMPUTED=
> SHORTTHIS IS A LONGER CHARACTER STRING1234567890123456789012345678901234567890
> 12345678901234567890123456789012
> CORRECT=
> SHORT THIS IS A LONGER CHARACTER STRING 123456789012345678901234567890123456789
> 012345678901234567890123456789012
>
> **gfortran**
>
> COMPUTED=
> SHORTTHIS IS A LONGER CHARACTER STRING123456789012345678901234567890123456789012345678901234567890123456789012
> CORRECT=
> SHORT THIS IS A LONGER CHARACTER STRING 123456789012345678901234567890123456789
> 012345678901234567890123456789012
>
> So the expected output was generated with `gfortran` in mind. But why is the output from `flang-new` different? You referred to white spaces in list-directed output, but the formatting seems identical with respect to white spaces.
You're right, it's not about whitespace. I don't remember why I thought one of them was splitting at the 0 and one at the 9, I must've accidentally looked at the value printed after "CORRECT=". I guess the difference is only whether or not it splits at all. From what I managed to google up, gfortran never introduces a newline, but ifort does unless told otherwise on the command line. As you can see, flang also introduces a newline by default. To be honest, I don't understand the standardese around list-directed output very well, and since both behaviours exist in the wild I think we should try to accept both. WDYT? (I'll try to update the summary accordingly if you agree with the approach)
Repository:
rT test-suite
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D128262/new/
https://reviews.llvm.org/D128262
More information about the flang-commits
mailing list