Opened 9 years ago

Closed 9 years ago

#455 closed defect (fixed)

Bug in ropp_io_vlist_size.f90

Reported by: Ian Culverwell Owned by: Ian Culverwell
Priority: normal Milestone: 9.0
Component: ropp_io Version: 8.0
Keywords: vlists Cc:

Description

ropp_io/ropp/ropp_io_vlist_size.f90, the overloading of the fortran intrinsic SIZE function for the various (sub-) types of vlists, contains a bug:

FUNCTION size_vlist(vlist) RESULT(n),
...
  nn(1) = size_vlistD0d(vlist%VlistD0d)
  nn(2) = size_vlistD1d(vlist%VlistD1d)
  nn(2) = size_vlistD2d(vlist%VlistD2d)

  n = SUM(nn)

should of course read

FUNCTION size_vlist(vlist) RESULT(n
...
  nn(1) = size_vlistD0d(vlist%VlistD0d)
  nn(2) = size_vlistD1d(vlist%VlistD1d)
  nn(3) = size_vlistD2d(vlist%VlistD2d)

  n = SUM(nn)

Attachments (1)

test2.sh (1.1 KB ) - added by Ian Culverwell 9 years ago.
test2.sh

Download all attachments as: .zip

Change history (3)

comment:1 by Ian Culverwell, 9 years ago

According to the word of

grep -ir vlist $ROPP_SRC |grep -i size |grep -v svn | grep f90

SIZE(vlist) is never used by itself: ROPP only calls SIZE(vlist%VlistD0d) etc. So fixing this should have no effect. (Which is also why getting it wrong all these years didn't cause any problems.)

But to confirm, when we run ropp_apps_tph_tool on some (artificial) data with 0, 1, and 2D extra data, we find, at ROPP8.1:

 SIZE(ro_data1%vlist%vlistd0d) =            2
 SIZE(ro_data1%vlist%vlistd1d) =            6
 SIZE(ro_data1%vlist%vlistd2d) =            4
 SIZE(ro_data1%vlist)          =            6

which is obviously wrong, while at ROPP9.0:

 SIZE(ro_data1%vlist%vlistd0d) =            2
 SIZE(ro_data1%vlist%vlistd1d) =            6
 SIZE(ro_data1%vlist%vlistd2d) =            4
 SIZE(ro_data1%vlist)          =           12

which is obviously correct. (But the results are the same, thankfully.)

That's good enough: implementing at r4892.

Testing script also attached.

by Ian Culverwell, 9 years ago

Attachment: test2.sh added

test2.sh

comment:2 by Ian Culverwell, 9 years ago

Resolution: fixed
Status: newclosed

Closing ticket as fixed.

Note: See TracTickets for help on using tickets.