[Bug fortran/64138] gfortran interface issue

2014-12-02 Thread wong.david-c at epa dot gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64138

--- Comment #5 from david wong.david-c at epa dot gov ---
Hi,

   What is your fix?

   In the original code, c_sub_cr and c_sub_rc are distinct because the
sequence of argument type are different. Other compilers have no problem to
distinguish them. Please advise.

Cheers,
David


[Bug fortran/64138] New: gfortran interface issue

2014-12-01 Thread wong.david-c at epa dot gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64138

Bug ID: 64138
   Summary: gfortran interface issue
   Product: gcc
   Version: 4.9.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: fortran
  Assignee: unassigned at gcc dot gnu.org
  Reporter: wong.david-c at epa dot gov

Hi,

   I have created a complex number module:

   module complex_number_module
implicit none

integer, parameter :: loc_real_precision = 8

type complex_number
  real(kind=loc_real_precision) :: real_part, imag_part
end type complex_number

interface c_sub
  module procedure c_sub_cc,  ! z1 - z2
   c_sub_cr,  ! z1 - num, where num is a real
number
   c_sub_rc! num - z1, where num is a real
number
end interface

! --
type (complex_number) function c_sub_cc (z1, z2)

type (complex_number), intent(in) :: z1, z2

c_sub_cc%real_part = z1%real_part - z2%real_part
c_sub_cc%imag_part = z1%imag_part - z2%imag_part

end function c_sub_ccj

! --
type (complex_number) function c_sub_cr (z1, num)

type (complex_number), intent(in) :: z1
real(kind=loc_real_precision), intent(in) :: num

c_sub_cr%real_part = z1%real_part - num
c_sub_cr%imag_part = z1%imag_part

end function c_sub_cr

! --
type (complex_number) function c_sub_rc (num, z1)

type (complex_number), intent(in) :: z1
real(kind=loc_real_precision), intent(in) :: num

c_sub_rc%real_part = num - z1%real_part
c_sub_rc%imag_part = - z1%imag_part

end function c_sub_rc

  end module complex_number_module

When I compile with gfortran (version 4.6.4), I got the following error:

module_twoway_rrtmg_aero_optical_util.F:14.85:

 c_sub_rc! num - z1, where num is a real number
   1
Error: Ambiguous interfaces 'c_sub_rc' and 'c_sub_cr' in generic interface
'c_sub' at (1)

I don't see any ambiguity and I don't encounter any problem with other
compilers such pgi and ifort. Please advise.

Cheers,
David


[Bug fortran/64138] gfortran interface issue

2014-12-01 Thread wong.david-c at epa dot gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64138

--- Comment #2 from david wong.david-c at epa dot gov ---
Created attachment 34158
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=34158action=edit
a small code


[Bug fortran/64138] gfortran interface issue

2014-12-01 Thread wong.david-c at epa dot gov
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64138

--- Comment #3 from david wong.david-c at epa dot gov ---
(In reply to david from comment #0)
 Hi,
 
I have created a complex number module:
 
module complex_number_module
 implicit none
 
 integer, parameter :: loc_real_precision = 8
 
 type complex_number
   real(kind=loc_real_precision) :: real_part, imag_part
 end type complex_number
 
 interface c_sub
   module procedure c_sub_cc,  ! z1 - z2
c_sub_cr,  ! z1 - num, where num is a
 real number
c_sub_rc! num - z1, where num is a
 real number
 end interface
 
 ! --
 type (complex_number) function c_sub_cc (z1, z2)
 
 type (complex_number), intent(in) :: z1, z2
 
 c_sub_cc%real_part = z1%real_part - z2%real_part
 c_sub_cc%imag_part = z1%imag_part - z2%imag_part
 
 end function c_sub_ccj
 
 ! --
 type (complex_number) function c_sub_cr (z1, num)
 
 type (complex_number), intent(in) :: z1
 real(kind=loc_real_precision), intent(in) :: num
 
 c_sub_cr%real_part = z1%real_part - num
 c_sub_cr%imag_part = z1%imag_part
 
 end function c_sub_cr
 
 ! --
 type (complex_number) function c_sub_rc (num, z1)
 
 type (complex_number), intent(in) :: z1
 real(kind=loc_real_precision), intent(in) :: num
 
 c_sub_rc%real_part = num - z1%real_part
 c_sub_rc%imag_part = - z1%imag_part
 
 end function c_sub_rc
 
   end module complex_number_module
 
 When I compile with gfortran (version 4.6.4), I got the following error:
 
 module_twoway_rrtmg_aero_optical_util.F:14.85:
 
  c_sub_rc! num - z1, where num is a real number
1
 
 Error: Ambiguous interfaces 'c_sub_rc' and 'c_sub_cr' in generic interface
 'c_sub' at (1)
 
 I don't see any ambiguity and I don't encounter any problem with other
 compilers such pgi and ifort. Please advise.
 
 Cheers,
 David

Hi,

   I have attached a smaller version of the code and the way I compiled the
code is:

   gfortran -c -ffree-form d.F

Thanks,
David