<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/68383>68383</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [flang][runtime][omp2012] Wrong output while reading namelists
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            flang:runtime
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          NimishMishra
      </td>
    </tr>
</table>

<pre>
    LLVM flang produces incorrect output while attempting to read to a namelist. Consider the following reproducer:

```
      program main
 type array_t
          integer   ::  n = 0   
          real      :: a = 0.  
          real      ::  b = 0. 
        end type array_t

        type(array_t),save :: array_inp(1000)
 character*20  ::  name_inp = ''    
        namelist  /params/ &
                 array_inp,                        &
 name_inp

 open(UNIT=10,FILE="input",STATUS='OLD')
         read(10,NML=params)
 close(10)
         print *, name_inp
      end program
```

For the input file named `input` having contents:

```
&params
  array_inp =
   22784,  6.00, 12.00,
    4864,  8.00,  16.00,
  name_inp = 'my-name',
/
```

Compiled with `flang-new -g <filename>.f90` and run with `./a.out`, _empty_ newline is observed. As opposed, compiling with `gfortran -g <filename>.f90` and running with `./a.out`, correct output _my-name_ is observed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMGOozgQ_RrnUgoydkLIgUOGDNJI6d7D9OweIwMFeAU2sk1H-fuVHUh3MqPZsaIA9qvye8_lEtbKViFmZPuFbI8rMblOm-xVDtJ2L9J2RqxKXV-z0-nvF2h6oVoYja6nCi1IVWljsHKgJzdODi6d7BGEcziMTqoWnAaDovZPAUoM2EvrIsi1srJGA65DaHTf64tHG5xTG8IPhB4JXf4TOv_CJ4QxGt0aMcAgpJrn3XVEEMaI69l9hvohlcMWDQD45PwAoIDwI1A_84Q1KPrb24wVN2j0B1AoF-wjFFX9C36PGL9OWLog2J6w3Ip3vNMIC1KNhKUxpdQjbgmqThhROTSEHRj9pF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