- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
First off, my compiler and some platform details:
$ ifort --version ifort (IFORT) 16.0.1 20151021 Copyright (C) 1985-2015 Intel Corporation. All rights reserved. $ uname -a Linux tfe04 2.6.32-431.29.2.el6.x86_64 #1 SMP Sun Jul 27 15:55:46 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
(It's a login node of a supercomputer)
I have an example of some code (shown below) that does not compile, exhibiting error #6866 which, based on my searches of these forums, should have been fixed in an earlier version.
MODULE my_define IMPLICIT NONE PRIVATE PUBLIC :: my_type TYPE :: my_type INTEGER :: j = 0 INTEGER :: i = 0 CONTAINS PRIVATE PROCEDURE :: Equal PROCEDURE :: NotEqual PROCEDURE :: Compare GENERIC, PUBLIC :: OPERATOR(==) => Equal GENERIC, PUBLIC :: OPERATOR(/=) => NotEqual GENERIC, PUBLIC :: OPERATOR(.Compare.) => Compare END TYPE my_type CONTAINS ELEMENTAL FUNCTION Equal( x, y ) RESULT( is_equal ) CLASS(my_type), INTENT(IN) :: x, y LOGICAL :: is_equal is_equal = (x%j == y%j) .AND. (x%i == y%i) END FUNCTION Equal ELEMENTAL FUNCTION NotEqual( x, y ) RESULT( not_equal ) CLASS(my_type), INTENT(IN) :: x, y LOGICAL :: not_equal not_equal = .NOT. (x == y) END FUNCTION NotEqual FUNCTION Compare( x, y ) RESULT( is_equal ) CLASS(my_type), INTENT(IN) :: x, y LOGICAL :: is_equal is_equal = .TRUE. IF ( x%j /= y%j ) THEN print *, 'J component of my objects are different' is_equal = .FALSE. END IF IF ( x%i /= y%i ) THEN print *, 'I component of my objects are different' is_equal = .FALSE. END IF END FUNCTION Compare END MODULE my_define ! ======================= ! Test program for module ! ======================= PROGRAM Test_my USE my_define, ONLY: my_type IMPLICIT NONE LOGICAL :: is_equal TYPE(my_type) :: my, my_copy my%j = 1 my_copy = my IF ( my /= my_copy ) THEN is_equal = my .Compare. my_copy END IF END PROGRAM Test_my
When I compile the above I get:
$ ifort one_type.f90 one_type.f90(67): error #6866: Dotted string is neither a defined operator nor a structure component. [COMPARE] is_equal = my .Compare. my_copy -------------------^ compilation aborted for one_type.f90 (code 1)
As far as I can tell, my test code is correct and standard conforming. Am I missing something?
The same code builds and runs fine using gfortran 4.9.x
Thanks for any information
cheers,
paulv
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
At first glance I agree it should compile. We'll check it out - thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:
At first glance I agree it should compile. We'll check it out - thanks.
Intel compiler seems to have the problem with the procedure name being the same as the string between the dotted operators; as a check, try a different procedure name, say Compare_.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
FortranFan wrote:
Intel compiler seems to have the problem with the procedure name being the same as the string between the dotted operators; as a check, try a different procedure name, say Compare_.
Hello,
It appears you are correct. See below:
$ diff one_type.f90 one_type_renamed.f90 --- one_type.f90 2016-01-25 12:51:37.408615000 +0000 +++ one_type_renamed.f90 2016-01-25 12:51:06.914900000 +0000 @@ -10,10 +10,10 @@ PRIVATE PROCEDURE :: Equal PROCEDURE :: NotEqual - PROCEDURE :: Compare + PROCEDURE :: Compare_ GENERIC, PUBLIC :: OPERATOR(==) => Equal GENERIC, PUBLIC :: OPERATOR(/=) => NotEqual - GENERIC, PUBLIC :: OPERATOR(.Compare.) => Compare + GENERIC, PUBLIC :: OPERATOR(.Compare.) => Compare_ END TYPE my_type CONTAINS @@ -32,7 +32,7 @@ END FUNCTION NotEqual - FUNCTION Compare( x, y ) RESULT( is_equal ) + FUNCTION Compare_( x, y ) RESULT( is_equal ) CLASS(my_type), INTENT(IN) :: x, y LOGICAL :: is_equal is_equal = .TRUE. @@ -44,7 +44,7 @@ print *, 'I component of my objects are different' is_equal = .FALSE. END IF - END FUNCTION Compare + END FUNCTION Compare_ END MODULE my_define $ ifort one_type_renamed.f90 $
No compilation errors. Woohoo!
Obviously I would still like the compiler bug to be fixed, but thanks to FortranFan for the work-around! (and pointing out exactly what the problem was)
cheers,
paulv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Escalated as issue DPD200381107. I will reply here when there is news, but you do have a good workaround.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve Lionel (Intel) wrote:
Escalated as issue DPD200381107. I will reply here when there is news, but you do have a good workaround.
Thanks Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This has been fixed in the compiler source, but I don't yet know when the fix will appear. When I get more information I will let you know.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The fix should appear in the 17.0 product release, or if not, Update 1.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page