- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This may or may not be related to this other ICE.
[fortran]module test_mod
ABSTRACT INTERFACE
PURE REAL FUNCTION INTERPOLATION_FUNCTION(ARG)
REAL, INTENT(IN) :: ARG
END FUNCTION INTERPOLATION_FUNCTION
END INTERFACE
CONTAINS
!> \brief Returns a pointer to the function described by the text string
FUNCTION FIND_INTERPOLATION_FUNCTION(DESCRIPTION)
IMPLICIT NONE
! Arguments
CHARACTER(LEN=*), INTENT(IN) :: DESCRIPTION
! Result
PROCEDURE(INTERPOLATION_FUNCTION), POINTER :: FIND_INTERPOLATION_FUNCTION
! Private variables
! Start work
SELECT CASE (TRIM(DESCRIPTION))
CASE ('SINC')
FIND_INTERPOLATION_FUNCTION => SINC
CASE DEFAULT
WRITE(*,'(2A)') '**ERROR(FIND_INTERPOL_FUNCTION): could not work out what function you were looking for. ', TRIM(DESCRIPTION)
STOP 'Fatal error in FIND_INTERPOL_FUNCTION'
END SELECT
END FUNCTION FIND_INTERPOLATION_FUNCTION
PURE REAL FUNCTION SINC(ARG)
IMPLICIT NONE
REAL, INTENT(IN) :: ARG
! Private variables
REAL :: ARG2
! Start work
ARG2 = ARG
IF (ABS(ARG2) .LE. 1.0E-6) THEN
SINC = 1.0
ELSE
SINC = SIN(ARG2)/ARG2
ENDIF
END FUNCTION SINC
end module test_mod
program hello
use test_mod
implicit none
end program hello[/fortran]
Compiling this with ifort 11.1.064 gives this:
[bash]% ifort -c helloworld.f90 0_12032 : catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error. compilation aborted for helloworld.f90 (code 3)[/bash]
I'm not completely sure whether what I am doing is legal fortran - this is the first time I am writing a function where the result is a pointer to a function defined by an abstract interface. But either way, an ICE is not nice.
Do let me know if this is not legal Fortran - thanks.
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I believe what you are doing is legal, and it is the same issue as the other thread. The compiler does not like to see a function whose return type is specified by PROCEDURE(),POINTER.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - the reason I reported this separately is because when I commented out the SELECT CASE construct, compilation went fine as far as I remember.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure I like the sound of that :) I'm hoping this won't be a case of waiting for the next major release, but it sounded from the other thread that this might be the case...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is the sort of issue we try to fix in a monthly update. I said interesting because it makes me wonder what's really going on where removing the SELECT CASE causes the error to hide. In any event, I have given the developers all your test cases and they'll chew on it.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page