Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Unexpected error, possible bug.

jrfsousa
Beginner
409 Views
Hi all!

Compiling:

ifort -warn interfaces osc.f90
I get:
osc.f90: error #7977: The type of the function reference does not match the type of the function definition. [OPR_M^MLT]
If the "call dummy()" line is commented the error goes away.
Seems like a bug.
Best regards,
Jos Rui
!-- Code ---------------
module opr_m
implicit none
private
public :: &
opr_t, &
operator(*)
type :: opr_t
private
real :: factor
end type opr_t
interface operator (*)
module procedure mlt
end interface
contains
elemental function mlt(aa, bb) result(cc)
type(opr_t), intent(in) :: aa
type(opr_t), intent(in) :: bb
type(opr_t) :: cc
cc%factor=aa%factor*bb%factor
return
end function mlt
end module opr_m
program opr
use opr_m
implicit none
call dummy()
stop
end program opr
module opr_m
implicit none
private public :: & opr_t, & operator(*)
type :: opr_t private real :: factor end type opr_t
interface operator (*) module procedure mlt end interface
contains
elemental function mlt(aa, bb) result(cc) type(opr_t), intent(in) :: aa type(opr_t), intent(in) :: bb type(opr_t) :: cc cc%factor=aa%factor*bb%factor return end function mlt
end module opr_m
program opr use opr_m implicit none call dummy() stopend program opr
0 Kudos
4 Replies
jrfsousa
Beginner
409 Views
Ups... I pasted the code twice...
It ends at "end program opr"
Sorry... :-(
Best regards,
Jos Rui
0 Kudos
Steven_L_Intel1
Employee
409 Views
Which compiler version are you using? I can't reproduce this in reasonably current versions.
0 Kudos
jrfsousa
Beginner
409 Views
Hi Steve!
$ ifort -V
Intel Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.0.3.174 Build 20110309
Copyright (C) 1985-2011 Intel Corporation. All rights reserved.
$ ifort -warn interfaces osc.f90
osc.f90: error #7977: The type of the function reference does not match the type of the function definition. [OPR_M^MLT]
compilation aborted for osc.f90 (code 1)
Best regards,
Jos Rui
[fortran]module opr_m

  implicit none

  private
  public :: &
    opr_t, &
    operator(*)

  type :: opr_t
    private
    real :: factor
  end type opr_t

  interface operator (*)
    module procedure mlt
  end interface

contains

  elemental function mlt(aa, bb) result(cc)
    type(opr_t), intent(in) :: aa
    type(opr_t), intent(in) :: bb
    type(opr_t) :: cc
    cc%factor=aa%factor*bb%factor
    return
  end function mlt

end module opr_m

program opr
  use opr_m
  implicit none
  call dummy()
  stop
end program opr
[/fortran]
0 Kudos
Steven_L_Intel1
Employee
409 Views
Ah, I didn't go back that far. Please try again with a current version, such as 12.1.7. (Composer XE 2011 Update 7)
0 Kudos
Reply