Skip to content

[flang][runtime][omp2012] Wrong output while reading namelists #68383

@NimishMishra

Description

@NimishMishra

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates an unexpected problem or unintended behaviorflang:runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions