Namelists read in fortran 10.9 with int8 mode corruption

I’m using a simple while-loop to read namelists records from a file.
Turning “-i8” compiler option on causes segfault during reading
a namelist. I haven’t noticed such a problem with a previous realeses.
Changing read ‘iostatus’ to integer*4 solves the problem.

Example code:

     program nml_readloop

      Implicit none
      Integer :: Num_Items
      Integer :: ierr
      Integer :: Section
      Integer :: Item
      Namelist /ITEMS/ Section, Item

       num_items = 0
       ierr  = 0

       Open( Unit=10, File='Items', Iostat=ierr )
       If ( ierr .ne. 0) Then
        Stop
       End If

       Do While ( ierr == 0 )
        Read( Unit=10, Nml=items, Iostat=ierr )
        If ( ierr == 0 ) Then
         num_items = num_items + 1
        End If
       End Do

       write (0,*) 'num_items ', num_items

      end

Compiler version: pgf90 10.9-0 64-bit target on x86-64 Linux[/code]

Maciej,

Using this example and Items namelist file, I created an example
that fails with -i8. I have logged this as TPR 17412.


% more Items
&ITEMS Section=1 ,Item=10 /
&ITEMS Section=2 ,Item=20 /
&ITEMS Section=3 ,Item=30 /
&ITEMS Section=4 ,Item=40 /
&ITEMS Section=5 ,Item=50 /

% more test_namelist.f90
program nml_readloop

Implicit none
Integer :: Num_Items
Integer :: ierr
Integer :: Section
Integer :: Item
Namelist /ITEMS/ Section, Item

num_items = 0
ierr = 0

Open( Unit=10, File=‘Items’, Iostat=ierr )
If ( ierr .ne. 0) Then
Stop
End If

Do While ( ierr == 0 )
Read( Unit=10, Nml=items, Iostat=ierr )
If ( ierr == 0 ) Then
num_items = num_items + 1
print *,“Section=”,Section
print *,“Item=”,Item
End If
End Do

write (0,*) 'num_items ', num_items

end
% pgf90 -o test test_namelist.f90
% test
Section= 1
Item= 10
Section= 2
Item= 20
Section= 3
Item= 30
Section= 4
Item= 40
Section= 5
Item= 50
num_items 5
% pgf90 -o test test_namelist.f90 -i8
% test
Section= 1
Item= 10
Section= 2
Item= 20
Section= 3
Item= 30
Section= 4
Item= 40
Section= 5
Item= 50
Section= 5
Item= 50
Segmentation fault

Maciej,

A late announcement. TPR 17412 was corrected in an early 11.* release.

regards,
dave