[flang-commits] [PATCH] D153916: [flang][NFC] Add F2023X documentation

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Jun 27 17:13:10 PDT 2023


klausler added inline comments.


================
Comment at: flang/docs/F202X.md:90-95
+```
+  character(:), allocatable :: buffer
+  allocate(character(20)::buffer)
+  write(buffer,'F5.3') 3.14159
+  print *, len(buffer)
+```
----------------
everythingfunctional wrote:
> I'd be curious to know if you have any examples of real world code that rely on the length of a buffer not changing, or would have meaningful different observable behaviour. In my experience the typical usage would be more like:
> 
> ```
>   character(:), allocatable :: buffer
>   allocate(character(20)::buffer)
>   write(buffer,'F5.3') 3.14159
>   print *, trim(buffer)
> ```
> 
> which wouldn't show observably different behavior. Or at worst:
> 
> ```
>   character(:), allocatable :: buffer
>   allocate(character(20)::buffer)
>   write(buffer,'F5.3') 3.14159
>   print *, buffer
> ```
> 
> where it is observably different (no more trailing blanks), but is likely to be a welcome change, not an unwelcome one.
I'm going to have to add portability warnings for usage of deferred-length character allocatables in these contexts and see how often they are triggered by nonclassified codes in order to give you an accurate reproducible answer to that.  Part of the difficulty here is that this isn't usage that can be easily grepped for.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153916/new/

https://reviews.llvm.org/D153916



More information about the flang-commits mailing list