Opened 12 years ago

Closed 12 years ago

#269 closed Bug (fixed)

Compilation problem in domzgr.F90 on Linux with PGI compiler.

Reported by: krimog Owned by: nemo
Priority: lowest Milestone:
Component: OCE Version: release-3.0
Severity: Keywords:



I had a very minor problem with the following lines in domzgr.F90 with the PGI compiler

gsigw(jk) = -fssig( FLOAT(jk)-0.5 )
gsigt(jk) = -fssig( FLOAT(jk)     )

The compiler complains about kinds being incorrect. I propose to change the lines to:

gsigw(jk) = -fssig( REAL(jk,wp)-0.5_wp )
gsigt(jk) = -fssig( REAL(jk,wp)        )

since REAL is the proper F90 way of converting integer to reals.


Commit History (1)


Fix a conversion bug, see ticket #269

Change History (3)

comment:1 follow-up: Changed 12 years ago by smasson

I think we should check and replace everywhare in the code:

FLOAT(toto) by REAL(toto, wp)

REAL(toto) by REAL(toto, wp)

Kristian, do you really need the "_wp" in "0.5_wp" ? should we extend this remark to the rest of the code?

comment:2 in reply to: ↑ 1 Changed 12 years ago by krimog

I believe, that the current NEMO code rely on compilers having a "-r8" switch, since there are place in the code with

SUBROUTINE mysub(pa)
   REAL(wp) :: pa

called with

CALL mysub( 0.5 )

which really should be

CALL mysub( 0.5_wp )

I think, that you have fixed some of these calls in version 3, but not all of them. Most noticeable there is still calls to lbc_lnk without _wp on the last argument.

Enforcing "_wp" on all constant will remove this compiler requirement. In the above example it would strictly speaking not be needed as long as "wp" is of higher or equal precision than the default kind. It is however easier to recommend using _wp on all constant rather than relying on compilers to promote them due to other variables in the computations.

It is not important to me to have this changed, since all compilers I use have a "-r8" switch. It is more a "good programming practice" kind of thing. I think, that my problem would have been solved with just changing FLOAT to REAL, but I prefer the more general solution I outlined.

comment:3 Changed 12 years ago by rblod

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.