[flang-commits] [flang] [flang] Fix continued literals incorrect padding with -ffixed-line-length=none (PR #225051)

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Tue Sep 29 11:57:52 PDT 2026


================
@@ -0,0 +1,11 @@
+! RUN: %flang_fc1 -fdebug-unparse %s | FileCheck %s --strict-whitespace --check-prefix=DEFAULT
+! RUN: %flang_fc1 -fdebug-unparse -ffixed-line-length=132 %s | FileCheck %s --strict-whitespace --check-prefix=LEN132
+! RUN: %flang_fc1 -fdebug-unparse -ffixed-line-length=none %s | FileCheck %s --strict-whitespace --check-prefix=NONE
+! RUN: %flang_fc1 -fdebug-unparse -ffixed-line-length=0 %s | FileCheck %s --strict-whitespace --check-prefix=NONE
+      character*4 s
+      s = 'ab
+     +cd'
+      end
+! DEFAULT: s="ab{{( {59})}}cd"
+! LEN132: s="ab{{( {119})}}cd"
+! NONE: s="abcd"
----------------
eugeneepshteyn wrote:

Optional: this change also fixes Hollerith constants continued across lines with `=none`/`=0`. Before, the padding blanks were counted into the Hollerith, so the DATA statement failed to parse. It would need its own file, since the default-width runs reject this source (so does gfortran). For example, `fixed-line-length-none-hollerith-continuation.f`:

```fortran
! RUN: %flang_fc1 -fdebug-unparse -ffixed-line-length=none %s | FileCheck %s
! RUN: %flang_fc1 -fdebug-unparse -ffixed-line-length=0 %s | FileCheck %s
      integer*8 h
      data h /8Habc
     +defgh/
      end
! CHECK: DATA h/"abcdefgh"/
```

Before this PR:

```console
$ flang -fc1 -fdebug-unparse -ffixed-line-length=none fixed-line-length-none-hollerith-continuation.f
error: Could not parse fixed-line-length-none-hollerith-continuation.f
fixed-line-length-none-hollerith-continuation.f:5:7: error: expected '/'
       +defgh/
        ^
```

With this PR it passes (`DATA h/"abcdefgh"/`).


https://github.com/llvm/llvm-project/pull/225051


More information about the flang-commits mailing list