g95 bug: renaming an intrinsic used from amodule

45 views
Skip to first unread message

jfh

unread,
Jul 31, 2012, 9:43:21 PM7/31/12
to gg...@googlegroups.com
The following program appears to expose a bug in g95 0.93. A workaround is to insert a statement saying
  intrinsic huge
in the module. Without it, g95 fails to realise that big is generic. The program compiles as is and runs happily with gfortran, nagfor and Sun f95. The problem is caused by huge being renamed big when the module is used.

cayley[~/Jfh] % cat testonly6.f90
module bla
  integer :: i=huge(1)
end module bla
program test
  use bla, only: i, big => huge
  print*, i, big(1),big(1.0),big(1d0)
end program test
cayley[~/Jfh] % g95 testonly6.f90
In file testonly6.f90:6

  print*, i, big(1),big(1.0),big(1d0)
                        2        1
Warning (155): Inconsistent types (REAL(8)/REAL(4)) in actual argument lists at (1) and (2)
In file testonly6.f90:6

  print*, i, big(1),big(1.0),big(1d0)
                 2               1
Warning (155): Inconsistent types (REAL(8)/INTEGER(4)) in actual argument lists at (1) and (2)
/tmp/ccgPoa3M.o: In function `MAIN_':
testonly6.f90:(.text+0x77): undefined reference to `_g95_huge'
testonly6.f90:(.text+0xa6): undefined reference to `_g95_huge'
testonly6.f90:(.text+0xd2): undefined reference to `_g95_huge'
cayley[~/Jfh] %

-- JFH
Reply all
Reply to author
Forward
0 new messages